Shell awk

xiaoxiao2021-02-28  28

cat compare.txt | awk '{print $2}’

对compare.txt 的每一行执行print $2,  $2表示的是第二个字段

示例:

-sh-4.1$ cat kenny.txt 11 22 33 44 55 66 -sh-4.1$ cat kenny.txt | awk '{print $2}' 22 55 -sh-4.1$ cat kenny.txt | awk '{print $3}' 33 66

转载请注明原文地址: https://www.6miu.com/read-2300000.html

最新回复(0)