ps -ax | grep geany | awk ‘{print “kill -9 ” $1}’ | sh
kill -9
ps -ax | grep gedit | awk '{print $1}'Reference:
ps -ax | grep gedit | awk '{print $1}'
[awk] Pick up the field which I want
Question :
Files happy/stack/include/types.h and happy_build/stack/include/types.h differ
Solution :
awk '{print $2;}' compare_part4.txt # print column 2 of the line
awk -F"/" '{$NF=""; print $0}' # Don't print the last column of the line
sed 's! !/!g' # Replace all of the space to slash
awk '{print $2;}' compare_part4.txt | awk -F"/" '{$NF=""; print $0}' | sed 's! !/!g'
Result :
atheros/offload_stack/include/
$cat employee.txt
100 Thomas Manager Sales $5,000
200 Jason Developer Technology $5,500
300 Sanjay Sysadmin Technology $7,000
400 Nisha Manager Marketing $9,500
500 Randy DBA Technology $6,000
$ awk '{print $2,$5;}' employee.txt
Thomas $5,000
Jason $5,500
Sanjay $7,000
Nisha $9,500
Randy $6,000
$ awk '{print $2,$NF;}' employee.txt
Thomas $5,000
Jason $5,500
Sanjay $7,000
Nisha $9,500
Randy $6,000
$cat employee.txt 100/Thomas/Manager/Sales/$5,000
$ awk -F"/" '{print $2,$NF;}' employee.txt