grep output to show only matching file

Grep

Grep Problem Overview


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 Solutions


Solution 1 - Grep

grep -l 

(That's a lowercase L)

Solution 2 - Grep

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

Solution 3 - Grep

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

Solution 4 - Grep

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionpaultop6View Question on Stackoverflow
Solution 1 - Grepa'rView Answer on Stackoverflow
Solution 2 - GrepIain Samuel McLean ElderView Answer on Stackoverflow
Solution 3 - GrepMark RansomView Answer on Stackoverflow
Solution 4 - GrepVinod KumarView Answer on Stackoverflow