Skip to content

Instantly share code, notes, and snippets.

@ymt2
Last active October 8, 2015 02:17
Show Gist options
  • Save ymt2/3261806 to your computer and use it in GitHub Desktop.
Save ymt2/3261806 to your computer and use it in GitHub Desktop.
zsh: fulltext search
function search() {
if [ $# = 0 ]; then echo 'usage: search [path] text'; return; fi
local d="."
local w=$1
if [ $# = 2 ]; then d=$1; w=$2; fi
find "$d" -print0 | xargs -0 grep -nE "$w"
}
alias s='search'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment