Tuesday, August 19, 2008

tip to extract configured settings only in a config file

some config files are huge, and have more comments "#" and blank space than they do actual configured settings.
sometimes you need to just have a look at the settings that are configured and not all the comments.
to do this try the following.

cat filename.conf |grep -v "^#" | grep -v "^$" | less

will list the config file without all the lines with comments and will also leave out all the blank space
giving you information on your configured settings only.

the -v switch in grep tells grep to list files that do not contain the following string
the ^ (caret) means the beginning of a line and the $ means the end of a line and then passing the output
to less, allows you to page through the file using your arrow keys

No comments: