[WBEL-users] Combining text files

Phil Schaffner Philip.R.Schaffner@NASA.gov
Wed, 25 Aug 2004 13:32:17 -0400


On Wed, 2004-08-25 at 09:39 -0400, fefe@fefe.2y.net wrote:
> Jeff,
> 
> cat <firstfile.txt> >> <2ndfile.txt>
> to append the first file to the end of the 2nd file.
> 
> Eric
> 
> 
> On Tue, 24 Aug 2004, Jeff Maze wrote:
> 
> >    I have multiple M$ Windows DNS zone files that I would like to combine
> > into one file.  I'm sure there's a way to do it windows, but I imagine it'd
> > be even easier to do in Linux.

Safe bet.

> >
> >    Anyone know how I can accomplish this?
> >
> > Thanks..

More generally:

cat file_1 file_2 ... file_n > combined_file

or if naming convention allows, use wildcards:

cat file_* > combined_file

Can also use the traditional *NIX tool-chain approach to do some
manipulation along the way, say if there was some duplication and you
want unique lines sorted into the output, in UNIX rather than DOS
format:

cat file_* | sort | uniq | tr -d '\r' > combined_file

Phil

P.S.  Better to start a new thread with a new message, not a reply-to
and change the subject.  You started with a reply to the PPPoE thread, a
practice known as "hijacking foreign threads" which messes up threaded
mail readers.