Created
June 29, 2014 16:42
-
-
Save justinhj/f4cca62abf809eb49622 to your computer and use it in GitHub Desktop.
A bash script to easily search files for a regular expression
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
#!/bin/bash | |
# A simple script to recursively search files | |
if [ "$#" -ne 3 ]; then | |
echo "efind (easy find) usage: [path] [file pattern] [regex]" | |
echo 'efind ../c "*.c" "string"' | |
exit 1 | |
fi | |
find "$1" -name "$2" -type f -print0 | xargs -0 egrep -iHn "$3" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment