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

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

问题描述

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

我不希望%是在新的一行,它必须是在最后一行的末尾。

谢谢!


解决方案

  sed的'$ {S / $ /%/}'文件

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.

Thanks!

解决方案

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

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

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