HOWTO Remove comments and blank lines in a config file

From LinuxReviews
Jump to: navigation, search

Grep can remove all the comments and all the blank lines from a configuration file.

grep  -v ^# configfile | grep -v ^$

grep -v ^# will remove all lines beginning with # (While keeping lines with comments after the setting, as in Whatever = Foo #sets Whatever to Foo)

grep -v ^$ removes all blank lines.

Personal tools
hardware tests
Categories
Privacy policy
linux events
ipv6
Networking
IPv6

Search:

linux newz | random page | poetry | free blog