View Config Files Without Comments

Use this grep invocation to trim comments out of config files. Comments are great but can get in your way if you just want to see the currently running configuration. I’ve found files hundreds of lines long which had fewer than ten active configuration lines.
It’s really hard to get an overview of what’s going on when you have to wade through hundreds of lines of comments.

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.

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

This site uses Akismet to reduce spam. Learn how your comment data is processed.