in reply to Join files using perl
Faster? <shrug!> dunno, but pull up a chair. Here are the two input files..
and here's some code:$ cat file1.txt 1 2 3 4 5 $ cat file2.txt 5 4 3 2 1
which gives you this as an output:#!/usr/bin/perl -w use strict; use Tie::File; my ($file1,$file2,$fileout) = @ARGV; tie my @ry1,"Tie::File",$file1 or die "$file1:$!"; tie my @ry2,"Tie::File",$file2 or die "$file2:$!"; tie my @out,"Tie::File",$fileout or die "$fileout:$!"; @out=(@ry1,@ry2); untie @out; untie @ry2; untie @ry1;
$ cat out.txt 1 2 3 4 5 5 4 3 2 1
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Join files using perl
by linseyr (Acolyte) on Jan 11, 2013 at 19:42 UTC | |
by blue_cowdawg (Monsignor) on Jan 11, 2013 at 20:58 UTC | |
by Marshall (Canon) on Jan 12, 2013 at 22:28 UTC | |
by linseyr (Acolyte) on Jan 11, 2013 at 19:46 UTC | |
by linseyr (Acolyte) on Jan 11, 2013 at 19:51 UTC | |
by ww (Archbishop) on Jan 11, 2013 at 20:19 UTC |