man postsuper に記載されているmailq削除のawkをperlに変えてみた。
# mailq | tail -n +2 | grep -v '^ *(' | \
awk 'BEGIN { RS = "" } { if ($8 == "user@example.com" && $9 == "") print $1 }' \
| tr -d '*!' | postsuper -d -
# mailq | sed '1d' | grep -v '^ *(' | \
perl -00ane 'print "$F[0]\n" if $F[7]=~q/@example.com$/ && $#F<8' | \
tr -d '*!' | postsuper -d -
- 個人的な好みでtailはsedに変更。
- sedもgrepもtrも消したかったけど自分には無理だった。
- awkの$9は、recipient2。