4 thoughts on “Better Than Grep Leave a comment

  1. Pingback: Better Than Grep
  2. I’ve found ack to be better than grep for many of the searches I use, but having grep installed every where means I still end up using it a fair bit.

    In regards to your examples, both can be done with grep as well:

    grep -A 5 -B 5 ‘search_query’

    If you just want 5 lines on both sides you can do that with one option, -C:

    grep -C 5 ‘search_query’

    The -C works for ack as well.

    And the file list match option is the same too:

    grep -l ‘search_query’

    1. interesting – thanks for the pointers! I guess that shows how much I have looked into grep and its options 🙂

      To be honest I have been quite happy with grep until it wouldn’t search recursively for me, and I couldn’t work out why. Ack solved the problem and I guess that’s why I spent a bit of time reading the Ack docs.

      1. My most common use of grep is grep -ri search * the -r is for recursive, the -i is for case insensitive search. And the * of course means everything 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *