後,我有一個文件a.text:AWK - 打印完整的輸入字符串比較
hello world
my world
hello universe
我想打印完整的字符串,如果第二個字是「世界」:
[[email protected]:/var/log] cat a | awk -F " " '{if($2=="world") print $1}'
hello
my
但我想要的輸出是:
[[email protected]:/var/log] cat a | awk -F " " '{if($2=="world") print <Something here>}'
hello world
my world
任何關於如何做到這一點的指針?
在此先感謝。
我只想在第二個元素是「世界」時打印完整的輸入行。 –