Tuesday, June 11, 2013

How to use grep command to exclude the lines beginning with a pattern

For instance when reading from a file you want to exclude all the comments i.e. lines beginning with hash sign (#), then use -v switch for grep command:
grep -v "^\#" $FILENAME

No comments:

Post a Comment