linux awk '{print $2}' 用法

$2:表示第二个字段

print $2 : 打印第二个字段

awk '{print $2}' $fileName : 一行一行的读取指定的文件, 以空格作为分隔符,打印第二个字段

比如有个文件是testAWK.txt,文件内容如下:

11 22 33 44
55 66 77 88

执行 awk '{print $2}' testAWK.txt

结果:

22
66

批量杀进程:

kill -s 9  `ps -ef|grep -v grep |grep 'ios_subpkg_01'|awk '{print $2}'`

原文:https://blog.csdn.net/qq_32649581/article/details/85285600 

猜你喜欢

转载自blog.csdn.net/mengzuchao/article/details/88574515
今日推荐