Re:Beyond grep: ack, a code search tool for programmers
by pyre on Saturday July 20, 2013 @02:09PM
(#6075989)
Or you can do:
ack --python PATTERN [DIRECTORY]
Re:Beyond grep: ack, a code search tool for programmers
by michaelmior on Saturday July 20, 2013 @01:15PM
(#6075779)
I used to do the same, but this accomplishes the same thing and is much more concise
ag -i -G '\.py$' 'string or RE I am looking for'
Re:Beyond grep: ack, a code search tool for programmers
by troels on Saturday July 20, 2013 @04:05PM
(#6076349)
I'm pretty happy with `find|xargs grep` myself. Of course, I have an alias that hides the arcane incantation away under a single `frep`, but underneath it uses those tried and tested unix tools. An alias is usually simpler to carry with me to new systems as well.
Re:Beyond grep: ack, a code search tool for programmers
by ams6110 on Saturday July 20, 2013 @04:56PM
(#6076539)
My alias is my .bash_history :).
I grant that these other tools are great, but I like using the standard utilities because, among other things, once you learn 'find' and 'xargs' you can piece together all kinds of other commands and you don't have to remember a tool-specific syntax (at least for the 'find' and 'xargs' parts).
This lets me completely tailor the file I search using find's filters (e.g., only search files with a .py extension, and skip .svn/ directory). E.g. assuming I'm in my project's root directory: