[英]Append to last line in bash
This question is related to this one . 这个问题与此有关。
The file text.csv
contains: 文件
text.csv
包含:
#some text
some more text
b,a,c,
The file numbers.csv
contains: 文件
numbers.csv
包含:
32
34
25
13
I would like to append numbers.csv
to text.csv
like this: 我想追加
numbers.csv
到text.csv
是这样的:
#some text
some more text
b,a,c,32,34,25,13
I have tried some of the recommendations in the linked example, but they tend to put everything on one line. 我已经尝试了链接示例中的一些建议,但是它们倾向于将所有内容放在一起。 I really want to append only to the last line.
我真的只想追加到最后一行。 How can this be done?
如何才能做到这一点?
sed
and paste
will solve this sed
和paste
将解决此问题
$ sed '$s/$/'"$(paste -sd, numbers)"'/' letters
#some text
some more text
b,a,c,32,34,25,13
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.