使用 cat 命令创建一个文件,该文件是 2 个文件的合并 (linux)

With cat command create a file which is a merge of 2 files(linux)

我想做什么:

With cat command create a file named Merge which is the merge of
test.txt and Copy(in a different directory than test.txt)

test.txtCopy都包含相同的内容:

reglib
test.txt

所以我期望的是:

reglib
test.txt
reglib
test.txt

我尝试过的:

cat /home/eleve/Copy | cat test.txt >Merge.txt
cat /home/eleve/Copy >Merge.txt | cat test.txt >Merge.txt
cat /home/eleve/Copy >Merge.txt | cat test.txt >>Merge.txt

所有这些命令都给了我同样的错误结果:

reglib
test.txt

任何人都可以建议我正确的命令吗?谢谢。

您可以在多个文件上使用 "cat",在这种情况下,它会按顺序打印出来。

cat test.txt Copy