Wednesday, September 12, 2007

squeezed out multiple commented lines

Whooah, that is so fast.

Here's an email request to cover a simple and quick way on squeezing out multiple commented lines from config file as per email request. This is applicable to hundred lines of config file with a bunch of commented config lines.

# cat testfile.cfg
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is not a comment
# this is a comment
## still a comment
#
This is another uncommented line
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# grep -v '#' testfile.cfg
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is not a comment
This is another uncommented line
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

HTH

0 comments:

Sign up for PayPal and start accepting credit card payments instantly.
ILoveTux - howtos and news | About | Contact | TOS | Policy