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.
我有一个.txt
A B C D E F
和两个.txt
H J N
如何将第三列添加到 one.txt 中,例如:
A B H C D J E F N
我想使用 shell 脚本来做到这一点.. 有什么命令可以提供帮助吗?
paste救援。-d代表“分隔符”,我将其设置为“空格”。
paste
-d
$ paste -d' ' one.txt two.txt A B H C D J E F N
如果要将结果存储在 中one.txt,可以将其保存在临时文件中,然后one.txt用它替换:
one.txt
$ paste -d' ' one.txt two.txt > temp && mv temp one.txt
然后总结一下