Skip to main content

Strip comments and blank lines from file

(2019-02-15)

Problem

Wordy config files that are all comments and whitespace. We want to see the actual configuration.

Solution

#  sed -e 's/#.*$//g' -e '/^s*$/d' < FILE

(Source: a Stack Overflow post I can't find right now.)