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

Note: Only a member of this blog may post a comment.

Procedure to clearing the ConfigMgr (SCCM) client local cache (CCM cache) -Resolving Disk space isssue

Essentially the client cache is a temporary download location for software, applications and software updates that are deployed to a clie...