jimmydean has asked for the wisdom of the Perl Monks concerning the following question:
template.properties -------------------- stree.address=#enter address# city.name=place sate.name=unk current.txt -------------------- street.address=1234_ave_west city.name=seattle state.name=wa ####################CODE############################# open (templateFile, "C:/template.properties") or die "Could not open file: $!"; open (currentValues, "C:/current.txt") or die "Could not open file: $!"; foreach $line (<currentValues>) { ($k, $v) = split /=/, $line; foreach $tmpLine(<templateFile>) { print $k; if (m/$k/) { print $line; } else { print $tmpLine; } } } close templateFile; close currentValues;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Find and replace from two files
by 2teez (Vicar) on Aug 18, 2012 at 06:13 UTC | |
|
Re: Find and replace from two files
by Athanasius (Archbishop) on Aug 18, 2012 at 08:28 UTC | |
by jimmydean (Initiate) on Aug 18, 2012 at 15:39 UTC | |
|
Re: Find and replace from two files
by Anonymous Monk on Aug 18, 2012 at 03:43 UTC | |
|
Re: Find and replace from two files
by Kenosis (Priest) on Aug 18, 2012 at 15:45 UTC |