假设我有两个文件:
猫狗狒狒猫科动物犬类灵长类动物
我想在添加空格后将一个文件中的行附加到另一个文件的末尾.我知道一种在 bash 中使用 for 循环来做到这一点的方法,但我认为有一个命令可以做到这一点,我就是不记得了.
输出应如下所示:
猫科动物犬类狒狒灵长类动物 解决方案paste --delimiter=' ' file1 file2
注意:结果将被写入标准输出.如果要将结果存储在文件中,请使用重定向运算符:
粘贴 --delimiter=' ' file1 file2 >输出文件
运行 man paste
以获取有关该命令的更多信息.
Suppose I have two files:
cat dog baboon
feline canine primate
I want to append the lines from one file at the end of another file after adding a space. I know a way to do this using a for loop in bash, but I think there is a single command that can do this sort of thing, and I just can't remember it.
The output should look like:
cat feline dog canine baboon primate
解决方案
paste --delimiter=' ' file1 file2
Note: the result will be written to stdout. If you want to store the result in a file, use a redirection operator:
paste --delimiter=' ' file1 file2 > outputfile
Run man paste
for more information about the command.
上一篇:Android的CirclePageIndicator不工作工作、Android、CirclePageIndicator
下一篇:附加 <script src="></script>根据屏幕宽度显示头部宽度、头部、屏幕、根据