How to remove Postfix queue messages sent to a specific domain

This command deletes all mails sent to a recipient address that ends with @example.com

sudo mailq | tail -n +2 | awk 'BEGIN { RS = "" } /@example\.com$/ { print $1 }' | tr -d '*!' | sudo postsuper -d - 

I have tried this solution in ubuntu 12.04, and it doesn't work this way:

sudo mailq | tail +2 | awk 'BEGIN { RS = "" } / @example\.com$/ { print $1 }' | tr -d '*!' | sudo postsuper -d -

I need to change to this way:

postqueue -p | tail -n +2 | awk 'BEGIN { RS = "" } /@example\.com/ { print $1 }' | tr -d '*!' | postsuper -d -

Grep solution

mailq | grep example.com -B1 | grep -oE "^[A-Z0-9]{10,11}" | sudo postsuper -d -

assumes ID is between 10 and 11 digits, (based on inodes)