Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: How to concatenate the contents of two files?

by fletcher_the_dog (Friar)
on Sep 02, 2004 at 20:27 UTC ( [id://388089]=note: print w/replies, xml ) Need Help??


in reply to How to concatenate the contents of two files?

This little script will take any number of files given on the command line and concatenate them into the first file given on the command line:
my $outfile = shift; open OUT,">".$outfile or die "Could not open $outfile:$!\n"; print OUT $_ while <>;
Command Line Version:
perl -e 'open OUT,">".shift;print OUT <>' output *.txt

Replies are listed 'Best First'.
Re^2: How to concatenate the contents of two files?
by Aristotle (Chancellor) on Sep 02, 2004 at 20:31 UTC

    Commandline version:

    perl -please *.txt > output

    Well, I suppose one could dub this a useless of use of Perl and simply do

    cat *.txt > output

    Makeshifts last the longest.

      Or the dos version
      copy /v B.txt A.txt Or for multiple files copy /v B.txt +C.txt A.txt

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://388089]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-03-29 02:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found