Bash: add text to the last line of the file

How to add percent symbol% ​​to the end of the last line in a text file?

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

Thanks!

+4
source share
1 answer
sed '${s/$/%/}' file 
+18
source

All Articles