To look only at files matching a certain name (or part of a name) -name or -iname can be used.
-name pattern Base of file name (the path with the leading directories removed) matches shell pattern pattern. Because the leading directories are removed, the file names considered for a match with -name will never include a slash, so `-name a/b’ will never match anything (you probably need to use -path instead). The metacharacters (`*’, `?’, and `[]’) match a `.’ at the start of the base name (this is a change in findutils-4.2.2; see section STANDARDS CONFORMANCE below). To ignore a directory and the files under it, use -prune; see an example in the description of -path. Braces are not recognised as being special, despite the fact that some shells including Bash imbue braces with a special meaning in shell patterns. The filename matching is performed with the use of the fnmatch(3) library function. Don’t forget to enclose the pattern in quotes in order to protect it from expansion by the shell.
-iname pattern Like -name, but the match is case insensitive. For example, the patterns `fo*’ and `F??’ match the file names `Foo’, `FOO’, `foo’, `fOo’, etc. The pattern `*foo*` will also match a file called ‘.foobar’.
$ find /path/to/search/in/ -iname '201512*' -type f -print0 | xargs -0 grep "LookForString" /path/to/search/in/20151209-000855.LOG:2015-12-09 08:01:15 LookForString is in this file /path/to/search/in/20151219-001855.LOG:2015-12-19 23:15:47 LookForString is also in this file |