Hi all,
When I look for some keyword1 in path1 and the keyword1 is found several times in the same file, it returns the file path several times accordingly.
Is there any way to get distinct list of files (full file path) ?
Hi all,
When I look for some keyword1 in path1 and the keyword1 is found several times in the same file, it returns the file path several times accordingly.
Is there any way to get distinct list of files (full file path) ?
What exactly is the command you are using? if you use grep's `-l` option it should exit after the first match:
Code:-l, --files-with-matches 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.
or even better:
Code:ls -l /path1/*keyword1*
Budgie and loving it.
steeldriver, aromo2,
The -l option is exactly what I was looking for. Thanks!
... fwiw I assumed you were searching for files with the keyword within their contents, not in their filenames
Yes, I was looking for a way to find file with keyword1 as part of file text, not part of filename. Anyway, ls -l would be helpful sometimes as well.
Bookmarks