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.
我有一个名为 autodata.csv 的文件,有 20 列数据。我希望只打印第 8 列中带有“6”的行(对于圆柱体)。
所以,我有这个工作,但只打印数字 6,而不是所有列:
#!/bin/bash while read x do echo $x | awk -F ',' ' { print $8=6} ' done
但是,如果我添加其余的列,它会给我错误:
echo $x | awk -F',' ' { print $1":"$2":"$4":"$7":"$8=6}'
大概是这样的吧?
awk -F ',' '{ if ($8 == 6) { print $1":"$2":"$4":"$7":"$8 } }'
怎么样:
awk -F ',' '$8 == "6" {print $0}'