0
Asked on another forum - no answer yet so I thought I would ask here. I had to escape the backslashes in the grep lines to make the backslash show up in this post.
I have this but grep is not returning the from line. It is something to do with the relay= part of the line.
If I modify it to say relay=exampleXXX111.examplf.ex.examplf.com
, it outputs the line just fine.
There are other ways to get this info, but I would like an explanation for this specific example.
echo "Apr 4 05:00:24 example sendmail[3365]: x3440OxC003366: from=, size=10181, class=0, nrcpts=1, msgid=<4E94014993C44528C502E32E3239E0B@example.XX.example.com>, proto=SMTP, daemon=MTA, relay=exampleXXX111.examplf.ex.example.com [10.100.10.10]" | grep -v "to=.*\.example\.com"
NO OUTPUT
echo "Apr 4 05:00:24 example sendmail[3365]: x3440OxC003366: from=, size=10181, class=0, nrcpts=1, msgid=<4E94014993C44528C502E32E3239E0B@example.XX.example.com>, proto=SMTP, daemon=MTA, relay=exampleXXX112.examplf.ex.examplf.com [10.100.10.10]" | grep -v "to=.*\.example\.com"
OUTPUT:
Apr 4 05:00:24 example sendmail[3365]: x3440OxC003366: from=, size=10181, class=0, nrcpts=1, msgid=<4E94014993C44528C502E32E3239E0B@example.XX.example.com>, proto=SMTP, daemon=MTA, relay=exampleXXX112.examplf.ex.examplf.com [10.100.10.10]
1Please do some formatting according to the guidelines. – davidbaumann – 2019-04-08T10:04:38.063