2

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)

3 Answers 3

8

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.

3
  • Indeed, this is it (I should learn to read better). Thanks a bunch!
    – Brent
    Jun 15, 2009 at 17:14
  • Any idea why Outlook thinks these are "Extra" line breaks? It removes ALL OF THEM!
    – Brent
    Jun 15, 2009 at 17:15
  • It is trying to helpfully line-wrap so that lines that were made in an older mail client where formatting was done explicitly and not through indirect markup tags take advantage of your million-character-wide message view pane. Jun 15, 2009 at 18:17
5

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

sed "s/^/  /"
1

I think you might need:

sed 's/$/\r/g'
1
  • No, I tried \r, \r\n - all with the same results
    – Brent
    Jun 15, 2009 at 17:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .