[Ilugc] linux tips - stripe down comment lines from config files

  • From: kumar.craja@xxxxxxxxxxx (Raja Chinnathambi)
  • Date: Tue Jul 27 11:43:08 2010

Dear friends,

The following commands can be used to view the configuration files lines 
excluding comment lines.

[guest@localhost ~]$ sudo grep -v "^#\|^$" /etc/squid/squid.conf | nl

[guest@localhost ~]$ sudo sed '/^#/d;/^$/d' /etc/squid/squid.conf | nl

note : This commands will remove the comment lines begin with # and empty 
lines. 

If you want to remove any comment line begins that begins with any other 
character add the REGEX to remove those lines.

Thanks and Regards,
C Raja


Other related posts: