我有这个grep
命令:如何格式化“grep”的输出?
grep -e PIPPO -e PLUTO -e TOPOLINO *.csv >> result.txt
我所要的输出有这样的格式:
path of file, row of file, text found
有什么建议?
我有这个grep
命令:如何格式化“grep”的输出?
grep -e PIPPO -e PLUTO -e TOPOLINO *.csv >> result.txt
我所要的输出有这样的格式:
path of file, row of file, text found
有什么建议?
你需要做的:
grep -Hn -e PIPPO -e PLUTO -e TOPOLINO *.csv >> result.txt
您可以在不同的目录中运行grep的,如果你想的完整路径:
cd/
grep -Hn -e PIPPO -e PLUTO -e TOPOLINO /your/path/*.csv >> result.txt
如果你想只显示匹配的部分添加-o
grep参数:
grep -Hno -e PIPPO -e PLUTO -e TOPOLINO *.csv >> result.txt
http://www.thegeekstuff.com/2009/03/15-practical- unix-grep-command-examples/ – fedorqui