Bash: append text to last line of file

2019-02-13 08:05发布

问题:

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