As configuration files are often full with comments and blank lines reading them inside shell become tedious! Sometimes you just want to quickly recap active configuration option only. Mostly, comments starts with "#"(hash) or ";" (semicolon). Below is a command I often use while debugging various configuration files. For files having comment starting with ";" e.g. php.ini egrep -v "^([[:space:]]?$|;)" /path/to/file For files having comment starting with "#" e.g. my.cnf egrep -v "^([[:space:]]?$|#)" /path/to/file For lazy bumps… Following can take care of both of above! egrep -v "^([[:space:]]?$|;|#)" /path/to/file You may create a local alias for above command! Just in case you want to save output in a file… just add -- This Post Using grep to removing comments, newlines/whitespace from config files is Published on Devils Workshop . | |||
| |||
| |||
|
Sunday, 29 July 2012
Using grep to removing comments, newlines/whitespace from config files
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment