Print file (cat) without comments and empty lines


$ cat /etc/postfix/main.cf | egrep -v "(^#.*|^$)"
egrep -v      means leave the following out
^#.*          means patterns that begin with a #
|             means or
^$            means patterns that are empty

or

cat /etc/postfix/main.cf | egrep -v "^\s*(#|$)"

One Response to Print file (cat) without comments and empty lines

  1. ruslan3cc5efimov says:

    thanks

    Like

Leave a comment