Wednesday, January 20, 2010

Stripping comments from a file

You can run this command to strip comments (line starting with a #) and empty lines from a file in Linux:

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

I usually run this command on squid.conf, a file heavily commented.

To save the lines to file squiD.conf, you can run:

cat /etc/squid/squid.conf | grep -v ^# | grep -v ^$ > squiD.conf

Have fun!...

No comments:

Second monitor no display after latest update - KDE-neon

 After latest update as of Oct 3, 2023, my second monitor was undetected with latest kernel (6.2.0-33-generic). If I boot with previous kern...