0

Using QNX I am trying to list the processes that have been running for under 24 hours. I have the following code that will list every process' PID and elapsed time running. I have tried multiple loops to list only the PID's that have 'etime' greater than 2400 with no success.

ps -eo pid,etime,cmd | sed s/://g 

returns

   PID     ELAPSED CMD
     1       4618 
     2       4618 slogger
  4099       4618 pci-bios
  4100       4618 io-usb
  4101       4618 io-hid
  4102       4618 devc-con-hid
  4103       4618 devb-eide
204808       4612 inetd
229385       4612 /pclogd
 81930       4614 pipe
 81931       4614 mqueue
 94220       4614 dumper
 81933       4614 tinit
 94222       4614 io-net

Basially, I need if [elapsed -lt 2400];then list pid

1 Answers1

0
ps -eo pid,etime,cmd | sed s/://g | 
awk '$2 < 2400 {printf "%-10s %-10s %-20s\n", $2, $1, $3 }'