I am an active user of the find command, similar to the below format:
find . -name '*servername*' -exec zgrep -l 'identifier' {} \;
Suppose I have a hint that the target file may be in directory named abc, is it possible in find command or any of its combinations to accept hints?
For example, if the search first searches in subdirectories named abc there are more chances to find the results, and I can break the search operation if needed.
I am looking for some similar command:
find --hint dir1|pattern1 . -name '*servername*' -exec zgrep -l 'identifier' {} \;
Perhaps this is what you want:
find $(find . -type d -name abc
) -name '*servername*' -exec zgrep -l 'identifier' {} +
Demo:
$ mkdir /tmp/demo $ cd /tmp/demo $ mkdir -p a/b/abc $ echo identifier | gzip > a/b/abc/one_servername.gz $ find $(find . -type d -name abc ) -name '*servername*'-exec zgrep -l 'identifier' {} + ./a/b/abc/one_servername.gz