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.
我在下面使用这个命令来查找所有包含字符串的文件,但它不仅显示文件,还显示字符串所在的行。
rgrep "foobar" .
如何只显示文件名(包括路径)?
你需要 -l 选项
来自 grep 手册页:
-l, --files-with-matches Suppress normal output; instead print the name of each input file from which output would normally have been printed. The scanning will stop on the first match. (-l is specified by POSIX.)