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.

About this entry