4 ms·
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:
by dylanz 17y ago
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:
> 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'
- dylanz 17y agoOne day I'll grok the formatting for HN. Just not today obviously :/
- basugasubaku 17y agoFWIW "grep --color -n" does the same thing.
- dylanz 17y agoAh, 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.
- mseebach 17y agoNot if you're using SVN. Or if someone stuck a 24MB SQL data-dump with extended inserts somewhere, that has the word "unicorn" in it.
- youngian 17y agoThe newest version of grep has --exclude-dir, which handles .svn folders just fine.