Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在我的文本文件中,我有类似下面的内容,我想选择第二列值为“1”的行。
flower 1 12 tree 2 13 car 3 14 sun 1 20
我尝试过这样awk -F, 'int($1) == 1' test.txt > output.txt的事情:输出为空。我究竟做错了什么?
awk -F, 'int($1) == 1' test.txt > output.txt
awk 中的代码应该是:
awk ' $2=="1" {print}' test.txt >output.txt