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

  • From: girishvenkatachalam@xxxxxxxxx (Girish Venkatachalam)
  • Date: Tue Jul 27 12:54:58 2010

On Tue, Jul 27, 2010 at 11:42 AM, Raja Chinnathambi
<kumar.craja@xxxxxxxxxxx> wrote:

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.

$ grep -v '^#$' /etc/squid/squid.conf | vim -

or even

$ grep -v '^#$' /etc/squid/squid.conf | less

-Girish



-- 
Gayatri Hitech
web: http://gayatri-hitech.com

SpamCheetah Spam filter:
http://spam-cheetah.com

Other related posts: