Problem : How to grep only uncommented contents from any configuration file which is big in size, has many comments and blank lines
Solution: This can be achieved by following single command :
# grep -v '^$' /etc/httpd/conf/httpd.conf | grep -v '^ *#' | less
Explanation of command :
^$ : Matches and removes all blank lines
^ *# : Matches and removes all comments that starts with a “#” even with more spaces.
-v : To invert the selection
| less : To pipe the result in scroll format.
Webner Solutions is a Software Development company focused on developing CRM apps (Salesforce, Zoho), LMS Apps (Moodle/Totara), Websites and Mobile apps. If you need any software development assistance please contact us at email@example.com