Listing only active configuration from filename using grep

March 20th, 2010 | Your thoughts are welcome | Posted in Misc

Imagine a situation that  you want to see only the active configuration of squid.conf which is having 3532 line, to see the configuration you have to navigate through whole file from top to bottom, use this command to make your life easier.

# grep ^[^#] squid.conf

This will show only the files which are not starting with #,  means the active configuration you made in whole file, may be 5 or 10 lines.

Command Description

# grep ^[^#] filename

grep – filtering command

^ -  starting of the line

[^#] – ^ inside [ ] having different meaning (you have to learn regular expression ), [^] means “not” # the symbol, this could be anything # or @ or $ or anything.

filename – filename

Leave a Reply 1390 views, 2 today |
Tags: , , ,

Author :

I am a Linux and Networking geek, Interest to learn more and fun to do new experiments, happy to share knowledge that I have learned and experienced in my life and carrier, also trying to learn more on Firewalls, Linux, Switching, Routing etc..............

Leave a Reply

You must be logged in to post a comment.


More in Misc (20 of 33 articles)