How to remove ‘#’ characters from the unix/linux configuration file using sed editor

2007 December 7
by Aan Kasman

Sometime when i edit the config file using vi editor i must view all the ‘#’ character. I think this is not useful and wasting my time when every time to scroll down the vi and find the things that you need to edit.

This is the sample of the named config file that i want to see  my config without need to see the ‘#’ characters.

  • grep -v “^#” /etc/named/named.conf | sed -e ‘/^$/d’
  • cat /etc/named/named.conf | sed ‘/ *#/d; /^ *$/d’

Or you can use the simple one : 

  • sed ‘/ *#/d; /^ *$/d’ /etc/named.conf

Hope that helps

No comments yet

Leave a Reply

You must be logged in to post a comment.