Concatenate Files

It is sometimes useful or required to concatenate files.

One example could be log files, or files that have been split (as an example by a host like badongo, with *.aa, *.ab, *.ac… files).

Under Linux, this is feasible with the cat command.
For every file to concatenate, you only have to redirect the output of the cat command in the same file.

cat file1 > filename.ext
cat file2 >> filename.ext
cat file3 >> filename.ext

Under Windows, you can get the same result with the copy DOS command.

copy /B file1 + file2 + file3 filename.ext

At the end, filename.ext contains the concatenated content of the files file1, file2 and file3.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s