Here’s a short snippet that I always forget, or confuse for awk:
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. : )
You’re completely right Brie. This is a habit I’ve been trying to break for years but the muscle-memory is too strong :)
I’ve updated the gist accordingly. Thanks again Brie :)
name (required)
email ( will not be shown ) (required)
website
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. : )
You’re completely right Brie. This is a habit I’ve been trying to break for years but the muscle-memory is too strong :)
I’ve updated the gist accordingly. Thanks again Brie :)