Thursday, 23 February 2017

How to grep a specific pattern?

Like if I want to grep (outs 1_or_more_any_number_or_letter  : 1_or_more_any_number_or_letter  in lib/Target folder, I can do the following:

grep -Rl '(outs [a-zA-Z0-9][a-zA-Z0-9]*:\$[a-zA-Z0-9][a-zA-Z0-9]*,' lib/Target/


note here option -l (lower case L), meaning:

 -l, --files-with-matches
              Suppress normal output; instead print the name of each input file from which output would normally have been printed.
              The scanning will stop on the first match.  (-l is specified by POSIX.)

No comments:

Post a Comment