LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 09-20-2012, 06:52 AM   #1
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,797
Blog Entries: 4

Rep: Reputation: 285Reputation: 285Reputation: 285
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 system.test.com[167.129.51.11]: Connection refused)
appmgr@system.test.com

28B60127A19 2798 Thu Sep 10 11:11:29 MAILER-DAEMON
(connect to system.test.com[167.129.51.11]: Connection refused)
appmgr@system.test.com
....
......
.......

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

Last edited by shivaa; 09-20-2012 at 06:55 AM.
 
Old 09-20-2012, 01:45 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,974
Blog Entries: 11

Rep: Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879
I can think of several ways; the simplest is to grep for @.

Slightly more complex but relying on structure rather than
content:

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


Reply

Tags
awk, command, mailx, sed


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Requests to my ISP server are output in the middle of output by any command I run. stf92 Slackware 2 07-10-2012 08:38 AM
[SOLVED] truncate shell command puth Programming 5 03-18-2010 10:49 AM
How to redirect the output of exec command output in perl? sudhap85 Linux - Newbie 3 08-28-2009 03:35 PM
Grep on output of command returns all output traigo Linux - Newbie 2 02-24-2009 05:15 PM
truncate command butthead Linux - General 1 05-14-2002 03:40 AM


All times are GMT -5. The time now is 07:17 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration