I have this
root@messagerie-secours[10.10.10.19] ~ # cat /tmp/first20lines
Jul 7 19:35:23 smtpd 3D95D1E923C8 client=localhost[127.0.0.1]
Jul 7 19:35:23 cleanup 3D95D1E923C8 message-id=1436290501c8e5fc05ec3357fc654e7bd6b0c72a18@
Jul 7 19:35:23 qmgr 3D95D1E923C8 from=<xxx@infomaniak.com> nrcpt=1
Jul 7 19:35:23 pipe 3D95D1E923C8 to=<xxx@algerian-radio.dz> status=sent (delivered via maildrop service)
Jul 7 19:35:23 qmgr 3D95D1E923C8 removed
Jul 5 03:10:02 pickup 3165F1E923C8 from=<www-data>
Jul 5 03:10:02 cleanup 3165F1E923C8 message-id=<xxx@messagerie.algerian-radio.dz>
Jul 5 03:10:02 qmgr 3165F1E923C8 from=<xxx@messagerie.algerian-radio.dz> nrcpt=1
Jul 5 03:10:05 smtp 3165F1E923C8 to=<xxx@messagerie.algerian-radio.dz> queued as 900031E923C7
Jul 5 03:10:05 qmgr 3165F1E923C8 removed
Jul 5 03:10:05 smtpd 900031E923C7 client=localhost[127.0.0.1]
Jul 5 03:10:05 cleanup 900031E923C7 message-id=<xxx@messagerie.algerian-radio.dz>
Jul 5 03:10:05 qmgr 900031E923C7 from=<xxx@messagerie.algerian-radio.dz> nrcpt=1
Jul 5 03:10:05 local 900031E923C7 to=<xxx@messagerie.algerian-radio.dz> status=sent (delivered to command: procmail -a "$EXTENSION")
Jul 5 03:10:05 qmgr 900031E923C7 removed
Jul 7 11:49:25 pickup 7E57B1E923E8 from=<>
Jul 7 11:49:25 cleanup 7E57B1E923E8 message-id=<xxx@radio-lms>
Jul 7 11:49:25 smtp 7E57B1E923E8 to=<xxx@backup.algerian-radio.dz> queued as 9494B1E923C8
Jul 7 11:49:25 qmgr 7E57B1E923E8 removed
Jul 7 11:49:25 smtpd 9494B1E923C8 client=localhost[127.0.0.1]
root@messagerie-secours[10.10.10.19] ~ #
I want this (swap queue ID and process name then sort)
Jul 5 03:10:02 3165F1E923C8 cleanup message-id=<xxx@messagerie.algerian-radio.dz>
Jul 5 03:10:02 3165F1E923C8 pickup from=<www-data>
Jul 5 03:10:02 3165F1E923C8 qmgr from=<xxx@messagerie.algerian-radio.dz> nrcpt=1
Jul 5 03:10:05 3165F1E923C8 qmgr removed
Jul 5 03:10:05 3165F1E923C8 smtp to=<xxx@messagerie.algerian-radio.dz> queued as 900031E923C7
Jul 5 03:10:05 900031E923C7 cleanup message-id=<xxx@messagerie.algerian-radio.dz>
Jul 5 03:10:05 900031E923C7 local to=<xxx@messagerie.algerian-radio.dz> status=sent (delivered to command: procmail -a "$EXTENSION")
Jul 5 03:10:05 900031E923C7 qmgr from=<xxx@messagerie.algerian-radio.dz> nrcpt=1
Jul 5 03:10:05 900031E923C7 qmgr removed
Jul 5 03:10:05 900031E923C7 smtpd client=localhost[127.0.0.1]
Jul 7 11:49:25 7E57B1E923E8 cleanup message-id=<xxx@radio-lms>
Jul 7 11:49:25 7E57B1E923E8 pickup from=<>
Jul 7 11:49:25 7E57B1E923E8 qmgr removed
Jul 7 11:49:25 7E57B1E923E8 smtp to=<xxx@backup.algerian-radio.dz> queued as 9494B1E923C8
Jul 7 11:49:25 9494B1E923C8 smtpd client=localhost[127.0.0.1]
Jul 7 19:35:23 3D95D1E923C8 cleanup message-id=1436290501c8e5fc05ec3357fc654e7bd6b0c72a18@
Jul 7 19:35:23 3D95D1E923C8 pipe to=<xxx@algerian-radio.dz> status=sent (delivered via maildrop service)
Jul 7 19:35:23 3D95D1E923C8 qmgr from=<xxx@infomaniak.com> nrcpt=1
Jul 7 19:35:23 3D95D1E923C8 qmgr removed
Jul 7 19:35:23 3D95D1E923C8 smtpd client=localhost[127.0.0.1]
Best I could get is this (could swap queue ID and process name, but coudln't keep the columns nice and tidy), after reading this and this :
root@messagerie-secours[10.10.10.19] ~ # awk '{temp=$4; $4=$5; $5=temp; print}' /tmp/first20lines | sort
Jul 5 03:10:02 3165F1E923C8 cleanup message-id=<xxx@messagerie.algerian-radio.dz>
Jul 5 03:10:02 3165F1E923C8 pickup from=<www-data>
Jul 5 03:10:02 3165F1E923C8 qmgr from=<xxx@messagerie.algerian-radio.dz> nrcpt=1
Jul 5 03:10:05 3165F1E923C8 qmgr removed
Jul 5 03:10:05 3165F1E923C8 smtp to=<xxx@messagerie.algerian-radio.dz> queued as 900031E923C7
Jul 5 03:10:05 900031E923C7 cleanup message-id=<xxx@messagerie.algerian-radio.dz>
Jul 5 03:10:05 900031E923C7 local to=<xxx@messagerie.algerian-radio.dz> status=sent (delivered to command: procmail -a "$EXTENSION")
Jul 5 03:10:05 900031E923C7 qmgr from=<xxx@messagerie.algerian-radio.dz> nrcpt=1
Jul 5 03:10:05 900031E923C7 qmgr removed
Jul 5 03:10:05 900031E923C7 smtpd client=localhost[127.0.0.1]
Jul 7 11:49:25 7E57B1E923E8 cleanup message-id=<xxx@radio-lms>
Jul 7 11:49:25 7E57B1E923E8 pickup from=<>
Jul 7 11:49:25 7E57B1E923E8 qmgr removed
Jul 7 11:49:25 7E57B1E923E8 smtp to=<xxx@backup.algerian-radio.dz> queued as 9494B1E923C8
Jul 7 11:49:25 9494B1E923C8 smtpd client=localhost[127.0.0.1]
Jul 7 19:35:23 3D95D1E923C8 cleanup message-id=1436290501c8e5fc05ec3357fc654e7bd6b0c72a18@
Jul 7 19:35:23 3D95D1E923C8 pipe to=<xxx@algerian-radio.dz> status=sent (delivered via maildrop service)
Jul 7 19:35:23 3D95D1E923C8 qmgr from=<xxx@infomaniak.com> nrcpt=1
Jul 7 19:35:23 3D95D1E923C8 qmgr removed
Jul 7 19:35:23 3D95D1E923C8 smtpd client=localhost[127.0.0.1]
root@messagerie-secours[10.10.10.19] ~ #