We aims to provide in house support to our colleagues and the Engineers for any sort of technical help.You can raise your technical queriesor browse for any solutions for the probelms through our groups.We provide driver support,OS support and utility support too to make your life a better one.

Our Mission

Transform HCL Infosystems LTD into services and solution centric organization

Monday, March 8, 2010

View Config Files Without Comments

I've been using this grep invocation to trim comments out of config files. Comments are useful, but difficult to get only the active configuration entries which will be less than 20 or 25 lines from a very long file.

$ grep ^[^#] /etc/ntp.conf

The regex ^[^#] matches the first character of any line, as long as that character that is not a #. Because blank lines don't have a first character they're not matched either, resulting in a nice compact output of just the active configuration lines.

Your comments are always welcome.

Regards
Shiroy Pigarez

No comments:

Post a Comment