3 ms·
Similarly, I have a little shell function loaded by .zshrc that covers 90% of my use cases: findit() { find . -name \* -exec grep -iH $1 {} \; }
by msluyter 13y ago
Similarly, I have a little shell function loaded by .zshrc that covers 90% of my use cases:
findit() {
find . -name \* -exec grep -iH $1 {} \;
}
- aarmot 13y agoAuthor possibly meant something like this (but yeah, same idea) fffind () { find . -regex ".$1."; }
- deleted 13y ago[deleted]
- ralph 13y agoIs this not equivalent and avoids running grep(1) once for each path? find -exec grep -iH ${1?} {} + Though it still runs grep on directories.
- cwp 13y agoRight. There's no need to write a whole new tool just to simplify invocation for common cases. For a guy who uses the command line "a LOT" he's not making good use of his shell.
- knome 13y agoWhy not just run a recursive grep? That would save having to invoke grep on every single file found. findit() { grep -iHR $1 . } Alternately, you could use the '+' variant of -exec in order to batch files together to be processed together.
- msluyter 13y agoCool, I wasn't aware of a -R flag in grep for some reason. I need to go back and re-read the man pages...
- deleted 13y ago[deleted]