jott19 has asked for the wisdom of the Perl Monks concerning the following question:
new to perl... I want to purge my php.ini file of all comments, mostly.
some comments are commented directives that look like this:
;some_directiveexplanatory comments look like this:
; this directive does such and suchI want to keep the commented directives and purge the explanatory comments.
1 #!/usr/bin/perl 2 $iniprod = "php.ini-production"; 3 $ininocm = "php.ini-nocomments"; 4 open(NOCM, ">$ininocm"); 5 $txt = perl -ne 's/;\s.*// $iniprod'; 6 print NOCM $txt; 7 close NOCM or die "Could not close $ininocm";
I'm trying to assign the results of the regex purge to $txt, then write it to a new file.
any help appreciated... thx
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: regex basics
by CountZero (Bishop) on Jan 31, 2015 at 08:18 UTC | |
by AnomalousMonk (Archbishop) on Jan 31, 2015 at 16:43 UTC | |
by CountZero (Bishop) on Feb 02, 2015 at 08:48 UTC | |
by jott19 (Initiate) on Feb 01, 2015 at 01:36 UTC | |
by poj (Abbot) on Feb 01, 2015 at 13:29 UTC | |
by jott19 (Initiate) on Feb 01, 2015 at 21:51 UTC | |
by CountZero (Bishop) on Feb 02, 2015 at 13:12 UTC | |
by jott19 (Initiate) on Feb 02, 2015 at 14:01 UTC | |
by choroba (Cardinal) on Feb 02, 2015 at 15:28 UTC | |
| |
|
Re: regex basics
by Anonymous Monk on Jan 31, 2015 at 10:02 UTC | |
by pme (Monsignor) on Jan 31, 2015 at 10:41 UTC | |
|
Re: regex basics
by karlgoethebier (Abbot) on Feb 02, 2015 at 15:23 UTC | |
by Anonymous Monk on Feb 04, 2015 at 07:44 UTC |