shell同时读取多个文件合并 Posted on 2013-01-10 In Linux 现有多个文本文件想要合并在一起,以两个文件为例子吧: 1234#fileA.txtthis is File A line1this is File A line2this is File A line3 1234#fileB.txtthis is File B line1this is File B line2this is File B line3 想要实现交叉的合并,合并后结果为: 123456this is File A line1this is File B line1this is File A line2this is File B line2this is File A line3this is File B line3 command1: 1paste $fileA $fileB |tr "\t" "\n" > newfile command2: 1awk '{getline line < "fileB.txt";print $0;print line}' fileA.txt