开发者

grep output to show only matching file

开发者 https://www.devze.com 2023-01-19 07:53 出处:网络
What is the option for grep开发者_如何转开发 that will allow me only to print the matching file and not the line within a file that matches the criteria?grep -l

What is the option for grep开发者_如何转开发 that will allow me only to print the matching file and not the line within a file that matches the criteria?


grep -l 

(That's a lowercase L)


You can use the Unix-style -l switch – typically terse and cryptic – or the equivalent --files-with-matches – longer and more readable.

The output of grep --help is not easy to read, but it's there:

-l, --files-with-matches  print only names of FILEs containing matches


-l (that's a lower-case L).


Also remember one thing. Very important
You have to specify the command something like this to be more precise
grep -l "pattern" *

0

精彩评论

暂无评论...
验证码 换一张
取 消