-
-
Save DannyBen/4adadd0f573ec312e46e to your computer and use it in GitHub Desktop.
Find files and content in files
This file contains 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
if [ $# -lt 1 ]; then | |
echo " | |
ff - Find files and content in files | |
Find content in a file: | |
usage : ff [-t] EXTENSION SEARCH | |
example : ff php logdir | |
-t : omit text (show filenames only) | |
Find a file: | |
usage : ff PATTERN | |
example : ff *.css | |
" | |
exit 1 | |
fi | |
if [ $# == 1 ]; then | |
find . -name "$1" | |
elif [ $1 == "-t" ]; then | |
grep --color=always --include=*.$2 -rnwl . -e "$3" | less -rF | |
else | |
grep --color=always --include=*.$1 -rnw . -e "$2" | less -rF | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment