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

Popular posts from this blog

angular - DownloadURL return null in below code -

meteor - inserting data to database gives error "insert failed: Method '/texts/insert' not found" -