- 论坛徽章:
- 0
|
如题:
[:c10user:/tingcognos/ttingtest]$ cat ps1.txt
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 Sep 02 - 0:38 /etc/init
root 655422 1 0 Sep 02 - 0:00 /usr/ccs/bin/shlap64
root 1638528 1 0 Sep 02 - 713:06 /usr/sbin/syncd 60
root 1900708 1 0 Sep 02 - 19:16 /usr/lib/errdemon
root 2031688 3014794 0 Sep 02 - 0:25 /usr/sbin/portmap
db2inst1 2162942 6357196 0 Sep 02 - 0:00 db2vend (PD Vendor Process - 25![](static/image/smiley/default/icon_cool.gif)
root 2949254 3014794 0 Sep 02 - 0:00 /bin/ksh /opt/itlm/tlmagent
root 3014794 1 0 Sep 02 - 19:42 /usr/sbin/srcmstr
root 3211394 3014794 0 Sep 02 - 0:00 /usr/sbin/nimsh -s
想要截取第三第四列,并且打印类似下面的格式:
PPID C
0 0
1 0
1 0
........
但是使用下面的程序却打印出了(没有换行)
PPID C 0 0 1 0 1 0 1 0 3014794 0 6357196 0 3014794 0 1 0 3014794 0
程序:
aa=`awk -F" " '{print $3,$4}' ps.txt`
echo $aa
请问该如何换行 thanks
|
|