nice new tool to show version of feisty meow
[feisty_meow.git] / scripts / text / grep_two_patterns.sh
1 #!/bin/bash
2
3 folder="$1"; shift
4 pat1="$1"; shift
5 pat2="$1"; shift
6
7 if [ -z "$pat1" -o -z "$pat2" ]; then
8   echo "this script requires a folder and two patterns to search."
9   echo "all files in the folder (and sub-folders) that contain both patterns"
10   echo "will be displayed."
11   exit 1
12 fi
13
14 find "$folder" -type f -exec grep -lZ "$pat1" "{}" ';' | xargs -0 grep -l "$pat2"
15