如何追加的多个文件的内容到一个文件 [英] How to append contents of multiple files into one file
本文介绍了如何追加的多个文件的内容到一个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要的五个文件的内容复制到一个文件原样。我试着用cp为每个文件它做的事情。但是,这将覆盖从previous文件中复制的内容。我也试过
I want to copy the contents of five files to one file as is. I tried doing it using cp for each file. But that overwrites the contents copied from the previous file. I also tried
paste -d "\n" 1.txt 0.txt
和它没有工作。
我想我的脚本在每个文本文件的最后添加换行。
I want my script to add the newline at the end of each text file.
如。文件的1.txt,2.txt,3.txt。把1,2,3的内容0.txt
eg. Files 1.txt, 2.txt, 3.txt. Put contents of 1,2,3 in 0.txt
我该怎么办呢?
推荐答案
您需要的猫
(concatenate的简写)命令,与shell重定向(>
)到您的输出文件
You need the cat
(short for concatenate) command, with shell redirection (>
) into your output file
cat 1.txt 2.txt 3.txt > 0.txt
这篇关于如何追加的多个文件的内容到一个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文