-   Linux - Newbie (
-   -   How to truncate mailq command output (

shivaa 09-20-2012 07:52 AM

How to truncate mailq command output
Hello, as I hope all you're aware of output from "mailq" command.
For your information, it gives output in 3 rows, for example:


22713127A18 2798 Thu Sep 10 11:01:24 MAILER-DAEMON
(connect to[]: Connection refused)

28B60127A19 2798 Thu Sep 10 11:11:29 MAILER-DAEMON
(connect to[]: Connection refused)

So now I just want to list out recipient adresses (which are in 3rd row of every column of the output), so how can I achieve that?
Thanks in advance

Tinkster 09-20-2012 02:45 PM

I can think of several ways; the simplest is to grep for @.

Slightly more complex but relying on structure rather than

awk '{printf "%s\n",$3}' RS="\n\n" FS="\n"

All times are GMT -5. The time now is 11:18 AM.