Getting correct linefeeds in emails generated from linux

I have a script that emails certain linux log entries to me, and I read the email in MS Outlook.

The problem is that all the lines run together with no linefeeds between the lines.

To address this I inserted sed "s/$/\n/" before the mail command, but that gives me 2 linefeeds between each line in the email!

What is the proper way to get a single linefeed between each line (using sed)


Solution 1:

Check to make sure your Outlook isn't helpfully removing line breaks for you (ie the problem isn't Linux, it's Outlook). By default I think it does. It should be telling you this at the top of the view panel.

Solution 2:

If you add 2 spaces to the beginning of each line, Outlook will not remove the linefeeds.

sed "s/^/  /"

Solution 3:

I think you might need:

sed 's/$/\r/g'