Text file concatenation
You can combine multiple files into one file. Combining various files into one file is known as concatenation.
The following example creates file4, which consists of file1, file2, and file3, appended in the order below.
See the following examples:
- At the system prompt, type the following:
cat file1 file2 file3 > file4
- The following example shows a common error when concatenating files:
cat file1 file2 file3 > file1Attention: In this example, you might expect the cat command to append the contents of file1, file2, and file3 into file1. The cat command creates the output file first, so it actually erases the contents of file1 and then appends file2 and file3 to it.