Looking for the meat in a heavily commented config file

Just a quickie.

Thought I’d share a tidbit here. If you ever find yourself looking through a file and only want the lines that matter, you can pretty easily do this with ‘cat’ and ‘grep’. Whilw I won’t go into detail as to all the fun uses of these, not into the multitude of other ways to accomplish this, I will show you a quick way to get the meat of the file.

For example, openSuSe network interface config files are filled with comments and space.

To see what you actually have there, type this:
# cat /etc/sysconfig/network/ifcfg-eth0 | grep -v '^#' | grep -v '^$'

What this tell it to do is cat through the file (List eveything) while skipping lines that start with a # or are blank. The ‘-v’ means everything except.

Hope this helps someone.


Posted

in

,

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *