From thread
http://groups.google.com/group/ack-users/browse_thread/thread/c92ce0581bf6c7dd
...
On Jun 21 2008, 8:58pm I wrote:
> Is there any way to suppress the line number from the search output?
> Apparently not, according to my quick read of the code; looks like
> when $show_filename is true the line numbers will always be printed.
>
> I have a specialized search tool that currently uses GNU egrep which
> I'd like to adapt for ack, but I don't want line numbers in my output.
> (But I *do* want the filenames in the output.) I suppose I can strip
> them out by post-processing but it would be convenient if there was an
> ack option to suppress them.
>
> [ later in the thread I suggested the option --no-line-number for this ]
In response to that I just received a "me too" email from Jason
Tholstrup:
> I know this is old but I would also like to suppress line number
> output. This is good for piping into a sort uniq to find unique lines.
>
> Thanks,
> Jason Tholstrup
Jason makes a good point. I use grep in this way all the time:
grep "GET / " httpd-access.log | awk '{print $1}' | sort | uniq -c |
sort -rn
to generate a client address count report of HTTP accesses of the
front page of my website.
To do this using ack, I would have to add a 'sed' statement to the
pipeline to strip off the matching line numbers to enable uniq -c to
count the duplicated lines.
So, a --no-line-number option to ack would be handy in this case.
Thanks,
Matt