steph_bow has asked for the wisdom of the Perl Monks concerning the following question:
Dear Monks,
I would like to concatene data from two files (excel csv files). However, I would like to concatene only a part of them.
I have two files.
Name_1;Name_2 1;2 3;4
Name_1;Name_2 5;6 7;8
I have made the script
use strict; use diagnostics; use warnings; my $infile; my @FILES = glob('file_*'); my $outfile = "outfile.csv"; open(OUTFILE, ">$outfile"); foreach $infile(@FILES){ open(INFILE, "<$infile"); while (my $line = <INFILE>){ print OUTFILE $line; } close INFILE; } close OUTFILE;
The result is:
Name_1;Name_2 1;2 3;4 Name_1;Name_2 5;6 7;8
I would like to have only
Name_1;Name_2 1;2 3;4 5;6 7;8
Could you give me some advice ? Thanks a lot
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: data concatenation in an output file
by moritz (Cardinal) on Jan 25, 2008 at 14:55 UTC | |
by GrandFather (Saint) on Jan 25, 2008 at 15:20 UTC | |
|
Re: data concatenation in an output file
by jwkrahn (Abbot) on Jan 25, 2008 at 19:19 UTC |