Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!convex!usenet From: tchrist@convex.COM (Tom Christiansen) Newsgroups: comp.lang.perl Subject: Re: Scanning "ps" output with Perl Message-ID: <1991May03.184755.16450@convex.com> Date: 3 May 91 18:47:55 GMT References: <1991May3.162019.5613@uvaarpa.Virginia.EDU> Sender: usenet@convex.com (news access account) Reply-To: tchrist@convex.COM (Tom Christiansen) Organization: CONVEX Software Development, Richardson, TX Lines: 26 Nntp-Posting-Host: pixel.convex.com From the keyboard of ted@evi.com (Ted Stefanik): :I've noticed that several Perl utilities scan "ps" output using splits :and/or regular expressions. I'd like to add some cautions to these :approaches. : :When a particular process's statistics numbers get too big for the column space :alloted to that number, ps just slams the number into the preceeding column. This is unfortunately pretty OS dependent. Some versions (mine, for example) seems to guarantee a space between fields, even if some fields should get wide. USER PID %CPU %MEM SZ RSS TT STAT TIME COMMAND tchrist 550 53.1 0.1 6508 464 o2 R 0:01 ps axu user0 29596 0.0 12.6 65568 64300 q1 T N 10:34 program user1 22172 52.4 31.2 278648 78840 pc VR N 100:14 another_program The only thing here mildly difficult is finding all the STAT stuff, which can contains blanks. --tom -- Tom Christiansen tchrist@convex.com convex!tchrist "So much mail, so little time."