News for hackers. Stuff that matters.
Re:GNU grep 2.12 changes behavior of recursion options, brea... by pooriaazimi on Thursday July 26, 2012 @12:07PM (#4296711)
This is a serious question: Why would you want to use plain old "grep" instead of "ack"[1]? Of course, other than the fact that it's on all machines. Why would you use it instrad of "ack" on your own machines? That's an honest question, I'm not starting a flamewar... The highlighting and filename/line# by default is the killer feature for me.

Edit: Come on. Downvotes for this? Honestly... It's HN, not StackOverflow. You don't mark questions as "off-topic" unless they're trolling...

[1]: http://betterthangrep.com

Re:GNU grep 2.12 changes behavior of recursion options, brea... by MattJ100 on Thursday July 26, 2012 @01:08PM (#4297173)
The main reason to use grep is portability/availability. While a modern improvement to grep (yes, I'm an ack user and fan too) you can't simply depend on it in portable scripts and such.

grep is defined for POSIX after all: http://pubs.opengroup.org/onlinepubs/009695399/utilities/gre...

I also suspect (without looking) that there are obscure (but occasionally useful) grep features that ack doesn't support.

Re:GNU grep 2.12 changes behavior of recursion options, brea... by greyboy on Thursday July 26, 2012 @01:23PM (#4297299)
That's a fine recommendation for machines that you solely work on, or have complete control over. However, it's good to be able to work with the standard toolset if you frequently work on a variety of remote machines (where it's quite common that you cannot install such things, due to permissions or policies, and want to get started working before attempting to download/install a bunch of custom binaries).

Edit: MattJ100 made a more clear point while I was responding.

Re:GNU grep 2.12 changes behavior of recursion options, brea... by pooriaazimi on Thursday July 26, 2012 @02:01PM (#4297582)
Thanks for the response. However, a nice thing about ack is that it's not a binary (necessarily) - it's a perl script and can be used without sysadmin permissions: http://betterthangrep.com/install/

The other points are quite understandable and correct though. It's always best to at least be familiar with standard tools, even if you want to use an slightly different version for yourself.

Re:GNU grep 2.12 changes behavior of recursion options, brea... by greyboy on Thursday July 26, 2012 @03:44PM (#4298188)
I think we're probably mostly in agreement, even if I wasn't clear about it. In my line of work, there have been times where I was not permitted to use external scripts or binaries (highly sensitive environments). However, that one small example doesn't mean ack should be disregarded!
Re:GNU grep 2.12 changes behavior of recursion options, brea... by a3_nm on Thursday July 26, 2012 @02:30PM (#4297768)
ack-grep is a good tool to grep through files. grep is more than that. When I need to grep in a pipeline, I probably don't want ack-grep's bells and whistles.

One example of a useful feature of grep: "grep --line-buffered" to grep with no buffering in a pipeline.

Re:GNU grep 2.12 changes behavior of recursion options, brea... by benatkin on Thursday July 26, 2012 @06:55PM (#4299149)
It's called ack. Ubuntu gave its package and executable a different name because it conflicted with something far less notable (poor choice IMO). I suggest adding an a alias or a symbolic link so you can call it by its proper name when typing in commands.
Re:GNU grep 2.12 changes behavior of recursion options, brea... by haakon on Friday July 27, 2012 @04:07AM (#4300485)
Ubuntu didn't; debian did. Ubuntu just inherits that. Perhaps eventually they will fix it, which they did for git (which was once git-core because of a conflict with a less notable package).
Re:GNU grep 2.12 changes behavior of recursion options, brea... by audiodude on Thursday July 26, 2012 @12:26PM (#4296833)
I love ack, I've never looked back.
Re:GNU grep 2.12 changes behavior of recursion options, brea... by ghshephard on Thursday July 26, 2012 @07:16PM (#4299212)
I've been a systems administrator of one form or another for 19 years, spend 2-3 hours a day on the CLI, and I've never heard of ack. Depending on the time of day (and platform) i might use grep or egrep. I hopped onto one of the random ubuntu boxes I own, did a quick "apt-get install ack; man ack" - here is what it said:

"ACK is a highly versatile Kanji code converter. ACK can do reciprocal conversion among Japanese EUC"

This is probably why I don't use ack - never heard of it, not available on any system I use, and the dpkg repository has something that has nothing to do with grep.

Enough of an answer?

Re:GNU grep 2.12 changes behavior of recursion options, brea... by ksherlock on Thursday July 26, 2012 @07:51PM (#4299312)
debian installs it as "ack-grep".
Re:GNU grep 2.12 changes behavior of recursion options, brea... by eliasmacpherson on Thursday July 26, 2012 @02:18PM (#4297686)
ack has ignore built in for certain filetypes. Then combined with my shell expanding * to just the files and directories at the current layer, ack will not find certain things that grep -R string * will.
Re:GNU grep 2.12 changes behavior of recursion options, brea... by pbhjpbhj on Thursday July 26, 2012 @06:27PM (#4299073)
>Why would you want to use plain old "grep" instead of "ack"[1]? //

First time I've heard of it. Thanks. Only been grepping my way around for the last dozen years or so ...

Re:GNU grep 2.12 changes behavior of recursion options, brea... by jasomill on Thursday July 26, 2012 @02:59PM (#4297922)
Because it motivates me to avoid revision control systems that insist on crudding up every directory in my source tree?
Re:GNU grep 2.12 changes behavior of recursion options, brea... by csense on Thursday July 26, 2012 @09:13PM (#4299519)
> Why would you want to use plain old "grep" instead of "ack"?

1. Because all the cool kids are doing it.

2. Because I hate Perl.

Re:GNU grep 2.12 changes behavior of recursion options, brea... by koenigdavidmj on Friday July 27, 2012 @12:55AM (#4300087)
Why is your Perl hate relevant? It can be written in COBOL for all I care; I'm just using a tool to find files. I don't spend my days browsing through the source code of random tools.