3 ms·
Also check out Ack, a recursive grep-like tool that works like a charm when searching directory trees: http://betterthangrep.com/ http://betterthangrep.com/
by mustpax 17y ago
Also check out Ack, a recursive grep-like tool that works like a charm when searching directory trees:
http://betterthangrep.com/ http://betterthangrep.com/
- silentbicycle 17y agoThe reason that grep doesn't always have directory tree walking built in is because find already existed. Rather than implementing tree walking in each command-line utility, that functionality was factored out into its own program. That said, many greps have -r.
- georgecmu 17y ago-r will grep over a lot of files you don't want it to. A lot of times if my dir structure is not very complicated, I'll grep like this: grep smth [star].{cpp,h} [star]/[star].{cpp,h} [star]/[star]/[star].{cpp,h} but these stars get annoying very quickly.
- scrame 17y agozsh has a double-splat operator. You can just do [star][star]/[star].{cpp,h} and it will do a recursive match.
- sophacles 17y agoack is much nicer than find+grep in the simple cases. Also, defaulting to ignore .svn, .git, et al is fantastic. The --type feature is fun, and really makes it a great tool from within vim. On the other end, find + grep is absurdly powerful, making -r look puny in comparison.