Bash:将文本附加到文件的最后一行 [英] Bash: append text to last line of file

查看:24
本文介绍了Bash:将文本附加到文件的最后一行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在文本文件的最后一行末尾添加百分比符号 %?

How can I add a percentage symbol % to the end of the last line in a text file?

我不希望 % 出现在新行上,它必须在最后一行的末尾.

I do not want the % to be on a new line, it must be at the end of the last line.

谢谢!

推荐答案

sed '${s/$/%/}' file

这篇关于Bash:将文本附加到文件的最后一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆