in reply to Merging two files and changing format
#!/usr/bin/perl use warnings; use strict; open my $IN1, '<', 'infile_1' or die $!; open my $IN2, '<', 'infile_2' or die $!; open my $OUT, '>', 'test2' or die $!; while (my $in1 = <$IN1>) { chomp $in1; defined(my $in2 = <$IN2>) or die "file2 too short\n"; $in2 =~ s/\s//g; print {$OUT} join("\t", split /\s+/, $in1), "\t", join("\t", split + //, $in2), "\n"; } die "file1 too short\n" if <$IN2>; close $OUT;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Merging two files and changing format
by webby01 (Initiate) on Oct 11, 2012 at 18:32 UTC | |
|
Re^2: Merging two files and changing format
by webby01 (Initiate) on Oct 11, 2012 at 18:37 UTC | |
by choroba (Cardinal) on Oct 12, 2012 at 07:29 UTC | |
by webby01 (Initiate) on Oct 12, 2012 at 16:46 UTC | |
by choroba (Cardinal) on Oct 12, 2012 at 16:49 UTC | |
by webby01 (Initiate) on Oct 12, 2012 at 17:08 UTC | |
|