#!/usr/bin/perl # # ps format $PSfmt = "\"pid,ppid,pgid,user\""; # ps command $PScmd = `ps -ef -o $PSfmt`; # # run the command, output into array @PSarray = $PScmd ; # # eliminate leading spaces, and condense spaces for (@PSarray) {s/^\s+//; s/ +/ /g; print "$_ \n"; } exit; #### for $rec (@PSarray) { $rec = `echo "$rec"|tr -s ' '|sed 's/^ //'`; print "$rec\n"; } exit;