• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Parsing the Unix command output

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I want to parse the out put of Unix command like df, ps -ef.
While returning output of those command there is no column separator in the output only empty space is used as delimiter.
But my data contains space, so it is giving problem while parsing.

Does any body suggest their view.
Waiting for reply,

Thank
Parshuram
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Either investigate whether the format is fixed, meaning all columns always take up the same number of characters (in which case it's easy to extract the columns), or see if the columns can be separated by content. E.g., some columns can only contain numbers and can't have white space. You could try to come up with a regular expression that describes the format of a line that way.
 
reply
    Bookmark Topic Watch Topic
  • New Topic