Comment

Comment by danso

I like ag, but unless I'm missing something, ack has this killer flag which ag lacks:

    --output=expr
       Output the evaluation of expr for each line (turns off text
       highlighting) If PATTERN matches more than once then a line is
       output for each non-overlapping match.  For more information please
       see the section "Examples of --output".

Basically, it allows you to use captured groups in the output:

      cat file | ag '(\w+) (\d+)' --output '$1 is $2 years old'


On the other hand, ag allows multiline matching. So I end up using ag and ack together frequently.
parent danso 10 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton