THIS is why I wrote ack

8 views
Skip to first unread message

Andy Lester

unread,
Jun 10, 2009, 11:02:31 AM6/10/09
to ack-...@googlegroups.com
See my example in my reply at:

http://use.perl.org/~xsawyerx/journal/39110

xoxo,
Andy

--
Andy Lester => an...@petdance.com => www.theworkinggeek.com => AIM:petdance


Paul Miller

unread,
Jun 10, 2009, 1:41:33 PM6/10/09
to ack-...@googlegroups.com
On Wed, Jun 10, 2009 at 11:02 AM, Andy Lester<an...@petdance.com> wrote:
>
> See my example in my reply at:
>
> http://use.perl.org/~xsawyerx/journal/39110

Your example should somehow exclude the lines that aren't source...
since the filename is on a separate line and there's all those blank
lines... the line count has a different meaning imo -- not that I
think the grep is really accurate either...


--
If riding in an airplane is flying, then riding in a boat is swimming.
107 jumps, 43.5 minutes of freefall, 83.4 freefall miles.

Jan Dubois

unread,
Jun 10, 2009, 1:53:55 PM6/10/09
to ack-...@googlegroups.com
On Wed, 10 Jun 2009, Paul Miller wrote:
> On Wed, Jun 10, 2009 at 11:02 AM, Andy Lester<an...@petdance.com> wrote:
> >
> > See my example in my reply at:
> >
> > http://use.perl.org/~xsawyerx/journal/39110
>
> Your example should somehow exclude the lines that aren't source...
> since the filename is on a separate line and there's all those blank
> lines... the line count has a different meaning imo -- not that I
> think the grep is really accurate either...

These are all just approximations anyways. You'll find occurrences
of "goto" in comments as well, and they shouldn't really count either.
# like "goto http://whatever.com for more information"

Andy's point is still valid that you can get pretty much the same
information much easier using just ack then fiddling with find and grep.

Cheers,
-Jan

Andy Lester

unread,
Jun 10, 2009, 2:18:49 PM6/10/09
to ack-...@googlegroups.com

On Jun 10, 2009, at 12:53 PM, Jan Dubois wrote:

> Andy's point is still valid that you can get pretty much the same
> information much easier using just ack then fiddling with find and
> grep.


Right, I wasn't trying to be more accurate in the measurements, but to
show an easier way to get the same results.

In so many threads around the net I see people say "You can do
everything in ack that you can do with grep and find," and my answer
is "Sure you CAN, but why would you want to?"

xoa

Paul Miller

unread,
Jun 10, 2009, 5:33:32 PM6/10/09
to ack-...@googlegroups.com
> Right, I wasn't trying to be more accurate in the measurements, but to show an easier way to get the same results.

No, I get it. But *my* point was that it wasn't directly equivalent.
It's pretty common to count lines with grep. Maybe ack should have a
line counting mode built in, or the line should have been ...

ack stuff | ack : | wc -l

... just to be fair.

My point wasn't to say: Andy doesn't get it. Ack is cool. :P

Bill Ricker

unread,
Jun 10, 2009, 7:51:21 PM6/10/09
to ack-...@googlegroups.com
On Wed, Jun 10, 2009 at 1:53 PM, Jan Dubois<ja...@activestate.com> wrote:
>  You'll find occurrences
> of "goto" in comments as well, and they shouldn't really count either.


i post processed the ack output to count comments and quoted strings,
since they were quite stylized. wouldn't work if obfuscated but when a
codebase follows any styleguide, one can rely on that.

--
Bill
n1...@arrl.net bill....@gmail.com

Danny

unread,
Jun 11, 2009, 10:38:54 AM6/11/09
to ack dev/users
On Jun 10, 2:18 pm, Andy Lester <a...@petdance.com> wrote:
> In so many threads around the net I see people say "You can do  
> everything in ack that you can do with grep and find," and my answer  
> is "Sure you CAN, but why would you want to?"

It is interesting how people don't know it exists. It is such an
awesome tool. An example question from SO that was also needlessly
complex:
http://stackoverflow.com/questions/924340/how-do-i-write-a-bash-alias-function-to-grep-all-files-in-all-subdirectories-for/927415#927415

Bill Ricker

unread,
Jun 11, 2009, 9:59:43 PM6/11/09
to ack-...@googlegroups.com
On Thu, Jun 11, 2009 at 10:38 AM, Danny <deki...@gmail.com> wrote:
> is "Sure you CAN, but why would you want to?"

I ignored perl for years on such grounds until I got tired of zipping grep awk sed and shell files to insure they stayed together and realized in perl i only needed one file per script ... I was a devotee of AWK and their Little Languages book, so almost forgivable, but just as Larry said Awk needed to be better at one thing, sed and find and grep all still had uses.

If I had waited another year I could have missed the Perl 4  Perl 5 transition ...

I do hope Perl 6 is the answer to why i am ignoring Python, Ruby, ...


--
Bill
n1...@arrl.net bill....@gmail.com
Reply all
Reply to author
Forward
0 new messages