in reply to Re: Search and replace next line
in thread Search and replace next line
You replace one line in a file by rewriting the whole file( at least that is the easiest way). So you can use one of the two snippets above (I believe both work, but there seems to be dissent, so check first) to read your .ini file and write the results to a new file. Check if it is good and then copy it over the original .ini file.
If you feel confident in the script you can also automatically have Perl overwrite the input file with the -i switch.
perl -i rep.pl config.ini
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Search and replace next line
by perlnewbie2000 (Initiate) on Jan 05, 2005 at 12:07 UTC | |
by Thilosophy (Curate) on Jan 05, 2005 at 12:13 UTC | |
by Anonymous Monk on Jan 05, 2005 at 12:19 UTC | |
by perlnewbie2000 (Initiate) on Jan 05, 2005 at 12:29 UTC |