Print column 1 & 2
ps | awk '{print
$1,$2}'
To separate the columns
titles you can use "\t" between the numbers:
ps | awk '{print
$1"\t"$2}'
By default the field
separator for awk is a space, if it's not the case tell awk which one it is by
using F for field separator. In the example of /etc/passwd
file the separator is semi-colon
awk -F ":"
'{print $1}' /etc/passwd
You can also grep:
awk -F ":"
'{print $1}' /etc/passwd | grep myservice
To search for every last
field in the line, but r...
Continue reading ...