Grep only uncommented lines

In our daily work as sysadmins we sometimes bump into very large config files when we are only interested in a line or two. In this scenario our old good friend grep comes in handy.

Get rid of all lines containing #

We use the -v parameter to invert the search

grep -v '#' config_file

Get rid of all lines starting with #

We use ^ to indicate start of line

grep -v '^#' config_file



Written on September 23, 2017