Bash: append text to last line of file

人走茶凉 提交于 2019-11-30 04:37:01

问题


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!


回答1:


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


来源:https://stackoverflow.com/questions/3657860/bash-append-text-to-last-line-of-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!