Tuesday, March 30, 2010

Using egrep and sed to catch lines on configuration files

Unix/Linux systems has a wonderful way of extracting files from configs that you normally access and modify.  One such example would be to use the egrep tool to perform immediate look-up of configs that you check.  The goal here is simple to present to you lines which can be viewed readily. 

Older unix guys will use sed to perform the job like this:

$sed -e '/^[[:space:]]*#/d;/^[[:space:]]*$/d' file.conf 
For egrep the command would be:

$egrep -v '^#' file.conf 

No comments:

Post a Comment