+3 votes
in Operating Systems by (3.7k points)
I want to create one file by appending the data from several files. I can write a script to do that, but can I do this using any Linux command?

1 Answer

+1 vote
by (11k points)

There are several ways to combine the contents of files. One of the easiest ways is to use cat command.

Suppose I have 3 files a1.txt, a2.txt, and a3.txt with the following contents. I can use cat to combine them.

$ cat a1.txt
apple
banana
$ cat a2.txt
cat
dog
$ cat a3.txt
elephant
frog
$ cat a1.txt a2.txt a3.txt >a.txt
$ cat a.txt
apple
banana
cat
dog
elephant
frog

You can choose the sequence of files in cat command depending on how you want to append the data.
 

...