deamon help

Ed Vielmetti emv at ox.com
Wed Feb 6 11:01:17 AEST 1991


In article <2304 at inews.intel.com> bhoughto at hopi.intel.com (Blair P. Houghton) writes:

   For example (output of "ps alx | egrep 'TIME|foo'"):

	 F UID   PID  PPID CP PRI NI ADDR  SZ  RSS WCHAN STAT TT  TIME COMMAND
   94080012010 11236 11235255  96  41eba211194 9660       R N  pa143:58  (foo)
   b0000013092 17289   244  7   1  017232  41   21 be598 S    10  0:00 egrep TIME|

   PID 17829 is fine.  PID 11236 is a mess.  awk(1) and
   perl(1) would barf up gnodes at this.  (Those of you who
   smell challenge, smell aright.)

awk and sed (and perl for that matter) would do OK as long as they
didn't assume that whitespace was a field delimiter; break on absolute
columns with substr() or unpack().  that's not to say that ps doesn't
have an interesting idea of how to jam fields together...

If portability is not an issue I'd stick something into top (ps,sps
etc) to print out the fields you want in a nice, tagged, easy to parse
format.

--Ed
emv at ox.com

ps. c vs. awk vs. perl isn't a wizards issue at all.  hacking ps is.



More information about the Comp.unix.programmer mailing list