3 ms·
You can do a lot of things with `grep -E`, fwiw - there's not much here to really sell ack. Things that do sell ack, for me: ack css_class --sass # se
by Groxx 14y ago
You can do a lot of things with `grep -E`, fwiw - there's not much here to really sell ack.
Things that do sell ack, for me:
ack css_class --sass # search .sass and .scss
ack some_method --no-flash # ignore .as and .mxml
# ignore compiled css in every Rails project on
# my system (as long as I `ack` from the root)
--ignore-dir=public/stylesheets/compiled
And the fact that it prints out like this:
path/to/file.ext
123: some text matching
234: more text matching
path/to/other/file.ext
480: a match
instead of like this (with `-n`):
path/to/file.ext:123: a match
path/to/other/file.ext:567: another match
path/to/that/file/you/didnt/know/you_had.ext:32: yet another match
makes it massively more useful for human-viewing of the results than the normal behavior of grep. And it reverts to grep-like output when you pipe it into something, so you can go from exploration to composition with no effort.
- obviouslygreen 14y agoEntirely agreed. Other users' points about the tone of the article ring true to me as well, and they are only hurting people's impression of the tool, which is unfortunate; I use both ack and grep (my regex comfort level is not extremely high, so grep -v is still a common fallback). For the curious: It's "ack-grep" in Ubuntu's package manager (and presumably Debian, though I can't say for sure); I stick it on every machine/server I set up just to have it handy. Queries to the effect of ack-grep --python ClassName yield fast, readable, extremely useful output, as you mention. That's why I use it in addition to grep.