I'm using msmtp to create e-mail alerts on some RPi kiosks we have set up at my company, and unfortunately if I try to include the last 5 lines of a log file in the e-mail alert, msmtp doesn't handle the line breaks correctly and it prints all on a single line of text. If \n is included in each line in the log file, it outputs correctly in the e-mail alert.
A basic example for this command would be:
echo -e "This is a test. $(tail -5 /var/log/syslog)" | msmtp @domain
which does echo the syslog; yet it's all in one wall of text because
msmtp doesn't seem to handle line breaks. If I manually edit the syslog and add
\n to the end of each line, it prints properly
What's the proper syntax for sed or awk to add
\n to the end of every line in a log file?