Just for completeness. On Mac OS X (which uses the FreeBSD command), you must use the optional null string "" to edit in place without backing up:
sed -i "" 's/$/<br>/' mytext.txt
As an alternative to using sed to edit backups without space, you can use ed (1), which, however, reads the entire file into memory before running it.
printf '%s\n' H 'g/$/s//<br>/g' ',p' | ed -s test.file
For more information on ed (1) see
"Editing files using a text editor from scripts",
http://wiki.bash-hackers.org/doku.php?id=howto:edit-ed
bashfu
source share