Vim replacing linefeeds
vim
Solution
You nearly had it:
:%s/^\|$/|/g
`^\|$` means beginning or end of line. In a Vim regex, the `|` "or" pipe gets escaped. That is followed by `/|/g` -- replace with `|` globally.
Problem
I resisted Vim, but have now given in. It works large files like a hot knife through butter. Situation: I have a large text file, I want to put a pipe character at the beginning and ending of each line. Problem: These Vims and other variations didn't work: ``` :%s/$/|\$| :%s/\r/|\r| :%s/$/|\r| ``` I suspect it's something simple to fix this, but searching Google and Stack didn't help.