I know about
grep -rin 'text' /path/to/direcotry
But I dont want to look up in all the files . I just need to check for occurrence of 'text' in all files named wscript. How can that be done ?
man grep:
--include=GLOB
Search only files whose base name matches GLOB (using wildcard
matching as described under --exclude).
so try this:
grep -rin --include=wscript 'text' /path/to/files
grep -rin 'text' `find /path/to/directory -name wscript`
$()
instead. I'd also recommend not to use command substitution for parsing find output, it'll likely break. A safer alternative would be to pipe it to xargs
in a null-delimited format.
grep -rin 'your-text' /path/to/text/file/text-file.txt
It works only with text files, though.