我正在撰写一篇文章来阅读邮件内容并向一堆正则表达式进行管道处理,以获取一些重要的状态信息。
我的脚本是:
for ((i=START; counter<=${number_of_mails}; counter++))
do
mail_content=""$(echo $counter | mail -f /var/spool/mail/user)
# ....... processing mail content $counter
# doing some stuff
done
问题是mailcontent是&#34; raw&#34;像这样的邮件内容:
e: 12px; margin: 0px auto; font-family: Arial, sans-seri=
f !important;"></a> <a href=3D"http://post.spmailtechnolo.com/f/a/mg=
ds0nF2qSAHBvHw5u7zUw~~/AAEd7AA~/RgRbciuJP0EIACzE6PGZ5slXA3NwY1gEAAAAAFkHZGV=
TI5OTEmeHRvcj1FUFItMzEyOTcyNjEyLVtjb3VudGVyX29mZmVyX2NvbnRhY3RfMjAxNzA4MTRd=
LTIwMTcwODE0LVtpbnN0YWdyYW1dLVtdLVtdLVtdJnVybD1odHRwOi8vaW5zdGFncmFtLmNvbS9=
pZGVhbGlzdGFjb21HAnt9" style=3D"margin: 0px; padding: 0px; color: rgb(102, =
102, 102); font-size: 12px; font-family: Arial, sans-serif !important;"><im=
g src=3D"https://www.instagram.com/static/email/img/badge_instagram.png" al=
t=3D"instagram" style=3D"padding: 0px; border: none; font-size: 12px; margi=
n: 0px auto; font-family: Arial, sans-serif !important;"></a> </td></tr></t=
body> </table> </td></tr></tbody> </table> </td></tr></tbody> </table> </td=
></tr><tr id=3D"bottom" style=3D"margin: 0px; padding: 5px 0px 0px; font-fa=
mily: Arial, sans-serif; font-size: 15px;"> <td style=3D"margin: 0px; font-=
用正则表达式处理是一件痛苦的事。我只需要从邮件消息中获取一些信息。 如何阅读邮件消息并没有挣扎这些东西?只是阅读文本,而不是所有的HTML等