Last active
October 8, 2015 02:17
-
-
Save ymt2/3261806 to your computer and use it in GitHub Desktop.
zsh: fulltext search
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
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