Grep list only unique filenames

To list unique filenames using grep, do the following:

grep -irl "search-term" .

 

Notice the ‘l’ flag, short for –files-with-matches, defined as “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.”

The i flag just makes the search case-insensitive, and r is recursive.

Leave a Reply

Your email address will not be published. Required fields are marked *