Created
January 11, 2014 21:06
-
-
Save coderofsalvation/8376782 to your computer and use it in GitHub Desktop.
greps on keywords (keyword1 AND keyword2 AND ..)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # greps on keywords (keyword1 AND keyword2 AND ..) | |
| # @param string keyword | |
| # usage: printf "foo bar\nbar foo\n" | multimatch foo bar | |
| multigrep() { | |
| awk 'BEGIN{for(i=1;i<ARGC;i++) a[i]=ARGV[i]; ARGC=1} {for (i in a) if ($0 !~ a[i]) next; print}' "$@" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment