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.
打印包含 2 个以上项目的文件的行的命令是什么unix例如,每行中的文件都有由制表符分隔的项目。
unix
dog elephant fox dog monkey bear bird fish puppy
在上面的文件中,输出将是fox dog monkey.
fox dog monkey
在python中它将是:
if len(line)> 2: print line
用 awk
awk 'NF>2' file
.....................
另一个 awk 选项:
awk '{ if ($3) print $0}' file