Powerful regular expression pattern searching. # OR If you want to search for multiple conditions then you can use `OR` statements within the regular expression/pattern. There are two approaches, either escape the OR symbol, i.e. ''\|'' or use the ''-E'' flag. ```bash # These two are equivalent grep -E 'a|b' my_file.csv grep 'a\|b' my_file.csv ``` # From files If you have multiple conditions or terms you wish to be searched for using grep you can use the `-f` flag to pass a file of terms to search for. ```bash # Search for terms in 'file.txt' in files ending in *.py grep -f file.txt *.py ``` # Chained searches Here is [one solution](https://unix.stackexchange.com/a/326270/39149) when you want to chain searches on the output of previous searchesuses [recursion](https://en.wikipedia.org/wiki/Recursion#In_computer_science) which Bash does [support](https://stackoverflow.com/questions/9682524/recursive-function-in-bash) and is rarely used, but when it is can be incredibly powerful. ```bash function chained-grep { local pattern="$1" if [[ -z "$pattern" ]]; then cat return fi shift grep -- "$pattern" | chained-grep "$@" } ``` # Links * [Online grep Regular Expression](https://www.online-utility.org/text/grep.jsp) allows accounts so you can save your regexs. * [Python Regex](https://pythex.org/) ## Specific Solution * [grep, but only certain file extensions](https://stackoverflow.com/questions/12516937/grep-but-only-certain-file-extensions)