ALB*_*LBI 2 shell command-line join
我有one.txt
A B
C D
E F
Run Code Online (Sandbox Code Playgroud)
和two.txt
H
J
N
Run Code Online (Sandbox Code Playgroud)
如何将第3列添加到one.txt中:
A B H
C D J
E F N
Run Code Online (Sandbox Code Playgroud)
我想使用shell脚本执行此操作..是否有任何命令可以帮助?
paste救援.-d代表"分隔符",我把它设置为"空格".
$ paste -d' ' one.txt two.txt
A B H
C D J
E F N
Run Code Online (Sandbox Code Playgroud)
如果要将结果存储在其中one.txt,可以将其保存在临时文件中,然后替换one.txt为:
$ paste -d' ' one.txt two.txt > temp && mv temp one.txt
Run Code Online (Sandbox Code Playgroud)