: (to get into edit mode)
:wq (to write results and quit)
(go to the top line of the file)
M-x replace-regexp (return) $ (return) <br> (return)
Using perl from the command line:
perl -pi.bak -e 's/\n/<br>\n/' my.txt (unix shell)
perl -pi.bak -e"s/\n/<br>\n/" my.txt (Windows cmd shell - note double quote, lack of space after -e)
You can omit the ".bak" if you're willing to risk not having a backup when you modify your file in place.
If you don't have perl, why not? Unless you're reading this on your WAP phone, it's probably available for your computing platform.
: Ah yes, forgot to mention this: if you want to use stdin
, just omit the -i (and the .bak if you're using it), thus:
perl -p -e 's/\n/<br>\n/' <my.txt >mybr.txt (unix)
perl -p -e"s/\n/<br>\n/" <my.txt >mybr.txt (Windows)
You could also make a small script that would accept stdin and act as a filter, such as:
#!/usr/bin/perl (or wherever you've put it)
Perl is fun!