in reply to Copy data from one file and add it to another
#!/usr/bin/perl use warnings; use strict; my $infile = 'test.txt'; open INFO, '<', $infile or die "could not open '$infile' $!"; open FILEA, '<', 'outputfromvariantparser1.txt' or die "could not ope +n 'outputfromvariantparser1.txt' $!"; open FILEB, '>>', 'output.txt' or die "could not open 'output.txt' $!" +; my @raw_data = <FILEA>; while ( my $line = <INFO> ) { $line =~ s/TEXT TO BE REPLACED.*/$raw_data[0]/s; print FILEB $line; push @raw_data, shift @raw_data; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Copy data from one file and add it to another
by olus (Curate) on Apr 26, 2008 at 10:47 UTC | |
|
Re^2: Copy data from one file and add it to another
by Anonymous Monk on Jan 24, 2018 at 09:27 UTC | |
by poj (Abbot) on Jan 24, 2018 at 11:06 UTC | |
by jumdesumit (Novice) on Feb 01, 2018 at 10:31 UTC |