perl - How to match part of postfix log with regex? -
i need match following part of postfix log using grep.
aug 6 16:00:35 d1234567-002-e3 postfix/smtp[16032]: 3e60c7832
^^^^^^^^^^ so far way i've been able using negative lookahead, that's not allowed in current implementation of grep (not using perl regex).
i assumed along lines of... (not complete solution)
.*:.*:.*:
$ s="aug 6 16:00:35 d1234567-002-e3 postfix/smtp[16032]: 3e60c7832" for sed solution,
$ sed -e 's/.*]: //' <<< "$s" for grep solution,
$ grep -op ']: \k.*' <<< "$s" for awk solution,
$ awk '{print $nf}' <<< "$s"
Comments
Post a Comment