Adding Text to Lines in Vi

January 11, 2013

I wanted to add some text to the end of every line in a text document. This can be achieved in vi by doing a replace where the source string is simply $

This command typed into vi will add the word FOO to the end of every line:

:%s/$/FOO/g

Tags: vi vim