Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 15731

how to use awk command to cut field?

$
0
0

there is a file ,which you can get by command ps aux in linux.

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMANDroot         1  0.0  0.0   2280   732 ?        Ss   08:20   0:00 init [2]  root       327  0.0  0.1   2916  1456 ?        Ss   08:20   0:00 udevd --daemonroot      1681  0.0  0.0   2376   800 ?        Ss   08:20   0:00 /sbin/rpcbind -wroot      2071  0.0  0.1  27920  1708 ?        Sl   08:20   0:00 /usr/sbin/rsyslogd -c5

i want to get the content of last field,such as:

COMMANDinit [2]udevd --daemon/sbin/rpcbind -w/usr/sbin/rsyslogd -c5

when i use , $ awk '{print $11}' test,i get:

COMMANDinitudevd/sbin/rpcbind/usr/sbin/rsyslogd

when i use ,$ awk '{print $12}' test,i get :

[2]--daemon-w-c5

how can i do?


Viewing all articles
Browse latest Browse all 15731

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>