Linux コマンドを使用して、文字列を含むファイルの名前だけを一覧表示したいと考えています。
egrep を使用すると、文字列のすべてのインスタンスが表示されますが、これは複数回表示される可能性があります。
例えば:
egrep disco music_file*.txt
表示される場合があります。
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?
私が欲しいのは次のとおりです。
music_file1.txt
music_file2.txt
music_file3.txt
質問: Linux で文字列を検索するときに、各ファイル名のインスタンスを 1 つだけ表示するにはどうすればよいですか?