I know it sounds simple, but I want to e-mail the last 6 lines of a log file, which I have tailed into logresults.txt. I'm using
echo -e "Subject:server results\nFrom:server log <user@domain.com>\n"`cat logresults.txt` | sendmail -t user@domain.com
which works, but the body of the e-mail has no carriage returns, though the logresults.txt does. If I use sed to add \n to the end of logresults.txt, it just generates a line break in logresults.txt, which gives me the same results.
Is there a way I can append \n to the end of each line in logresults.txt so that actually gets piped to sendmail? I.e. append "\n" to then end of logresults.txt?