I want to specify only the names of the files containing the string using Linux commands.
When using egrep, all line instances are displayed, which can be multiple times.
For instance:
egrep disco music_file*.txt
Show
music_file1.txt: blah blah blah disco stuff music_file1.txt: disco blah blah blah music_file1.txt: I like to listen to italodisco music_file2.txt: I like to party to disco music_file3.txt: Does your dog like disco?
While all I want is:
music_file1.txt music_file2.txt music_file3.txt
Question: How can I just show one instance of each file name when searching for a string in Linux?
source share