4 ms·
A nice alternative to my decidedly low-tech approach: (in ~/.zshrc) # 'ff' command -- find string in files with a specified suffix ff() { [[ -n $1 &&
by _sh 17y ago
A nice alternative to my decidedly low-tech approach:
(in ~/.zshrc)
# 'ff' command -- find string in files with a specified suffix
ff() {
[[ -n $1 && -n $2 ]] || {
echo "Usage $0 [suffix] [string]"
echo "Where"
echo " suffix file suffix (without wildcards)"
echo " string string to search for (quote if spaces)"
return
}
find . -name \*$1 -exec grep -Hn $2 "{}" \; | less -RFX
}
Has colorized output, and only pages (with less) when there is more than one page to show.