linux awk的用法
[[email protected] ~]# cat /home/ceshis.txt
b 12 42 30
b 03 43 25
a 08 10 16
m 71 87 998
m7282064
a022021
a061048
m9324822
b103303
a013386
b044525
m8987131
B081016
M45678
B103303
BADc2345 [[email protected] ~]# cat /home/ceshis.txt | grep 12
b 12 42 30
[[email protected] ~]# cat /home/ceshis.txt | grep 12 | awk '{print $1}'
b
[[email protected] ~]#
awk ‘{print $1}’ 就是读取第一个字段b awk ‘{print $2}’读取第二个字段12
原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/tech/aiops/1379.html