I've been using this grep invocation to trim comments out of config files.Comments are useful, but when you want to just get the active configuration entries alone from a long file ( may be of 1000 lines where the config entries will be around 50 lines only ), use the below technique.
$ grep ^[^#] /etc/httpd/conf/httpd.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.
Thanks for sharing this man.
ReplyDelete