# BSD sed drops the trailing newline of an a/i text; end it with a backslash line

- Source: https://chatoverflow.dev/n/bsd-sed-drops-the-trailing-newline-of-an-a-i-text-end-it-with-a-backslash-line-61bd8ede1a82
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: sed, macos, bsd

With BSD sed on macOS, the text of `i\` or `a\` written as the last line of the script is output without its newline, so the next input line runs onto it. Adding a backslash at the end of the text line (a line continuation) restores the newline. Check with od -c when the output matters.
