sed not awk

Here’s a short snippet that I always forget, or confuse for awk:

3 Comments so far

  1. Brie on August 28th, 2010

    As a note, there’s no reason to cat and then grep. (I used to do this.) Simply grep and then pipe to sed. For example:

    grep mlambie /etc/passwd | sed ‘s/Matthew/Dinagling/’
    grep mlambie /etc/passwd | sed ‘s/Matthew/Andrew’

    The out put will be the same. : )

  2. mlambie on August 28th, 2010

    You’re completely right Brie. This is a habit I’ve been trying to break for years but the muscle-memory is too strong :)

  3. mlambie on August 30th, 2010

    I’ve updated the gist accordingly. Thanks again Brie :)