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.
我有这个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:
-o
grep -Hno -e PIPPO -e PLUTO -e TOPOLINO *.csv >> result.txt