Strip comments and blank lines from file in Unix

Command shown below displays configuration file and strips commented and blank lines on Unix-like operating system.

grep -E -v '^\s*#|^\s*$|^\s*;' file

or

egrep -v '^\s*#|^\s*$|^\s*;' file

Leave a Reply

(optional)

This site uses Akismet to reduce spam. Learn how your comment data is processed.