Re:Ack - better than grep, a power search tool for programmers
by pyre on Thursday December 03, 2009 @08:13PM
(#975586)
Worth mentioning that there is another program in the Ubuntu repos called ack. They've renamed this to ack-grep (don't use Debian so I don't know if the naming convention was pulled in from Debian Unstable or added by the Ubuntu devs).
Re:Ack - better than grep, a power search tool for programmers
by dylanz on Thursday December 03, 2009 @08:12PM
(#975582)
I've been using Ack for a while, and really like it. It saves a few keystrokes, and gives you a nice (colored) output of the results with line numbers as well:
Re:Ack - better than grep, a power search tool for programmers
by dylanz on Thursday December 03, 2009 @08:24PM
(#975603)
Ah, thank you! Can't believe I haven't been using the -n flag all this time. These flags don't do "exactly" the same thing as Ack, as Ack actually breaks it down by distinct sections, with newlines. It's a bit easier on the eyes.
Re:Ack - better than grep, a power search tool for programmers
by oliveoil on Friday December 04, 2009 @03:33AM
(#976016)
The time I sometimes lose reading HN pays off when I find stuff like this. BTW the type heuristics is good enough to look inside of files to determine the type: doing 'ack --python pattern' WILL DO look into python files that have no extension (like the toplevel module for instance).
Re:Ack - better than grep, a power search tool for programmers
by sparky on Thursday December 03, 2009 @08:22PM
(#975599)
Create a .ackrc file in your home directory. For you, it will contain:
--type-set
objj=.j
I found this on the ack-grep man-page in Ubuntu. You can set the ACKRC environment variable to give it a different directory (besides ~) to search for your .ackrc. Each line of the .ackrc is a command-line arg that will be prepended to any specified arguments every time you run ack-grep. If you don't want those arguments for a particular query, pass the --noenv flag to ignore the .ackrc. HTH!
Re:Ack - better than grep, a power search tool for programmers
by frig on Friday December 04, 2009 @09:43AM
(#976394)
Just something I had a hard time figuring out and seems poorly documented:
--type-set=scala=.scala # works in .ackrc
--type-set scala=.scala # doesn't work in .ackrc
...despite the version with one equals being correct command-line sequence. Only seems to matter if you want each flag on a single line in your .ackrc file. Might not be true for everyone.
Re:Ack - better than grep, a power search tool for programmers
by aidenn0 on Thursday December 03, 2009 @11:47PM
(#975819)
I have a wrapper around find that does things like filter out .svn directories. I sometimes use ack for simple searches, but find/xargs/grep together are faster and more explicit in my experience.
Re:Ack - better than grep, a power search tool for programmers
by netghost on Friday December 04, 2009 @01:48PM
(#976935)
I love the Textmate bundle. I actually extended it a bit so that you could filter for file types, which might be handy to some folks: http://github.com/adamsanderson/ack-tmbundle
Re:Ack - better than grep, a power search tool for programmers
by thwarted on Thursday December 03, 2009 @08:06PM
(#975573)
Fortunately, your search tool doesn't need to be written in the same language your project is.
That being said, performance comparisons would be interesting. Not necessarily from a "which is better" standpoint, but from a "what can these projects borrow from each other", assuming it's not a straight port.
alias ack='ack-grep'
http://news.ycombinator.com/item?id=223977
http://news.ycombinator.com/item?id=830522
http://github.com/aristus/ack-shell
> grep -r unicorn .
./config/unicorn/unicorn_build.rb: logger unicorn_logger
./config/unicorn/unicorn_build.rb: old_pid = '/home/rails/xxxxx/current/tmp/pids/unicorn.pid.oldbin
./config/unicorn/unicorn_production.rb: '/home/rails/xxxxx/current/tmp/pids/unicorn.pid.oldbin'
> ack unicorn
config/unicorn/unicorn_build.rb
10:# logger unicorn_logger
14:# old_pid = '/home/rails/xxxxx/current/tmp/pids/unicorn.pid.oldbin'
config/unicorn/unicorn_production.rb
15:# '/home/rails/xxxxx/current/tmp/pids/unicorn.pid.oldbin'
But there's also (last I looked, may be more now): http://www.rooijan.za.net/?q=ack_el
(M-x rgrep in Emacs == grep -r everywhere else)
Emacs' rgrep DIR PATTERN REGEX translates to
That being said, performance comparisons would be interesting. Not necessarily from a "which is better" standpoint, but from a "what can these projects borrow from each other", assuming it's not a straight port.