View Uncommented lines

View Only Configuration File Directives ( uncommented lines of a config file )
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
# echo 'egrep -v "^\s*#|^$" $1 $2' > /bin/uv ;chmod +x /bin/uv
# echo 'egrep -v "^\s*#|^\s*;|^$" $1 $2' > /bin/uv ;chmod +x /bin/uv
sed example
GNU sed example:
$ sed '/ *#/d; /^ *$/d' /path/to/file
$ sed '/ *#/d; /^ *$/d' /etc/apache2/apache2.conf

Removing blank lines from text files
Task: Remove blank lines using sed
Type the following command:
$ sed '/^$/d' input.txt > output.txt
Task: Remove blank lines using grep
$ grep -v '^$' input.txt > output.txt
Both grep and sed use special pattern ^$ that matchs the blank lines. Grep -v option means print all lines except blank line.