Hello,

On 2019-04-16 8:13 p.m., L A Walsh wrote:
[...]
Very often I want to search for something but only in my shell or perl
scripts and likely within the past 'X' months, stringing everything
together in a pipeline is certainly possible but awkward when
what I really want to do is search for a string or function name in
all shell scripts:


There are existing tools that do so very well, for example 'ack'
(https://beyondgrep.com/):

   ack --shell --perl 'foo|bar'

To limit searches by file attributes, combine with find/xargs:

   find -type f -mtime -60 -print0 \
      | xargs -0 ack --shell --perl 'foo|bar'


Or, if you wanted to list files based file-type (which
can be later combined with 'xargs -0'):

   ack --shell --perl -f --print0


-assaf


Reply via email to