darshephard
09-12-2007, 09:16 AM
I am a newbie to the Linux world so sorry for the basic question. I am trying email a file using postfix to my inbox. The problem comes from inserting the text file as the body of the email. If I use the mail command only I get an unformatted chunck of text.
What I need is a \n (newline) at the end of each line of text in the file. I accomplished the task using awk, but wondered if there was a better way using something different. My working command is listed below. Thanks in advance for any input.
awk 'sub("$", "\n")' /tmp/testfile > /tmp/testfile.txt; mail -s "testfile in body" darshephard@help.com < /tmp/testfile.txt
What I need is a \n (newline) at the end of each line of text in the file. I accomplished the task using awk, but wondered if there was a better way using something different. My working command is listed below. Thanks in advance for any input.
awk 'sub("$", "\n")' /tmp/testfile > /tmp/testfile.txt; mail -s "testfile in body" darshephard@help.com < /tmp/testfile.txt