I've been using this command:
find /path~ -type f | xargs grep -iR STRING1
to find strings in multiple files, but i was wondering me how can i find a string in multiple files, Case Sensitive, and even if the string is in other string.
For example:
I'm searching for: Encoder
abcdEncoder
— should appearabcdencoder
— shouldn't appearencoderEncoder
— should appearMaybe the question is a duplicate, but i haven't find it!
Remove the -i
switch to make the matches case-sensitive. Your command already searches multiple files and doesn't care whether the string is inside another string, so that'll give you what you want.
Also note that using both find -type f
and -R
is redundant: as -type f
ensures find
will only print normal files for grep
to examine, the -R
(recurse through directories) option won't change anything. Alternatively, you can use -R
to get rid of find
and xargs
: grep -R STRING1 /path~