I'd like to know if there is a way that I could cat
file like php.ini
and remove all lines starting with ;
For example, if the file contained this:
; - Show all errors, except for notices
;
;error_reporting = E_ALL & ~E_NOTICE
;
; - Show only errors
;
;error_reporting = E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR
;
; - Show all errors except for notices
;
error_reporting = E_ALL & ~E_NOTICE
and I ran the correct command cat | {remove comments command}
, then I would end up with:
error_reporting = E_ALL & ~E_NOTICE
Note - I assumed that cat
would be the best way to do this but I'm actually fine with the answer using another utility like awk
, sed
, egrep
, etc.
error_reporting = E_ALL & E_NOTICE ; Show all errors, except for notices
? Should the comment be removed in that case as well? – user Dec 07 '11 at 08:29cat
is the tool to concatenate files.grep
is the tool to filter lines based on patterns.sed
andawk
can also modify those lines. – Stéphane Chazelas Jan 28 '13 at 12:32