Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想使用命令 linux 粘贴两个文件paste(也欢迎任何其他选项)但增加第二个文件的行。最好举个例子:
paste
文件 1
a b c d e f
文件2
1 2 3 4 5 6 7 8 9 10 11 12
我想创建 file3 为:
a 1 b 3 c 5 d 7 e 9 f 11
用于仅awk打印文件二中的奇数行:
awk
$ awk 'NR%2' file2 | paste -d' ' file1 - a 1 b 3 c 5 d 7 e 9 f 11 # Using process substitution $ paste -d' ' file1 <(awk 'NR%2' file2) a 1 b 3 c 5 d 7 e 9 f 11