Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

concatenate two text files 1

Status
Not open for further replies.

ggggus

Programmer
Jul 5, 2003
114
I'm a linux newbie, but I've figured enough out to get awstats installed and set up a cron job to ftp in access logs from some of my websites...

The host creates a log file for each day, how do I take these files and merge them into one file so that awstats can chug through them?

***************************************
J. Jacobs
 
I forgot to mention that I'm running MDK 10 on an old PII 300 and it is command line only, no GUI.

***************************************
J. Jacobs
 
G'day,

this should do it:

cat file1 file2 > file3

This will concatenate file1 and file2 and redirect the output to file3.

Of course you can add more files by adding more files to the above line.

If you wish to append to the output file, then use ">>" instead of ">"

Have fun, Dave.
 
Ok, if I run cat on gzip'ed files, will they still work?
These log files are really bloated when not zipped, can I work append the latest gzip'ed file to the whole log file without unzipping?

***************************************
J. Jacobs
 

the above link is to the man page for gzip - so you can read it there or by using man gzip from the prompt.

Multiple compressed files can be concatenated. In this case, gunzip will extract all members at once. For example:

gzip -c file1 > foo.z
gzip -c file2 >> foo.z

Then

gunzip -c foo

is equivalent to

cat file1 file2
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top