Friday, May 30, 2008

Config Files

To view just the uncommented lines of text in a config file use grep, sed , awk, perl or any other text processing utility provided by UNIX / BSD / Linux systems.

grep example

GNU grep example:
$ grep -v "^#" /path/to/config/file
$ grep -v "^#" /etc/apache2/apache2.conf



sed example

GNU sed example:
$ sed '/ *#/d; /^ *$/d' /path/to/file
$ sed '/ *#/d; /^ *$/d' /etc/apache2/apache2.conf

No comments: