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

问题描述 投票:0回答:1

我正在尝试做的事情:

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

有人可以建议我正确的命令吗?谢谢。

linux cat
1个回答
2
投票

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

cat test.txt Copy
© www.soinside.com 2019 - 2024. All rights reserved.