Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> It highlights the selected text,

    grep --color
> it shows which files, and in what line the text was found (and uses vivid colors so you can distinguish them easily),

    grep -rn --color pattern ./files/
    files/foo.sh:123:    echo "Look at the floral pattern on this dress!"
> ignores .git and .hg directories (among others, that shouldn't be searched) by default,

    git --exclude=.git --exclude=.hg --exclude=.svn
> you can tell it to search, for example for only `--cpp` or `--objc` or `--ruby` or `--text` files (with a flag, not a filename pattern),

You would use `find` in conjunction with `grep`. "Art of Unix Programming", modularity, and all that jazz. Presumably you would just modify your own grep alias or define a function to avoid retyping. The end result pretty much looks like my grep alias:

    alias grep='grep -Ein --color --exclude=.git --exclude=.hg --exclude=.svn'
I still fail to see a reason to use ack, especially when I can assume grep is always available for portability.


...and many many other neat features that I'm sure grep has, but you have to remember and memorize them. ack has sensible defaults.

That's why.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: