LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-21-2011, 06:55 AM   #1
dikkiedik
LQ Newbie
 
Registered: Aug 2008
Posts: 3

Rep: Reputation: 0
need a script/command


Hi there,

I'm trying to cat the maillog, only find the mail-address who have send to info@example.com and put that mail-address into a file.

So far, i'm not getting this done.

Please help.

Kind regards,

Roland
 
Old 10-21-2011, 07:07 AM   #2
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Rep: Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615
Without giving you the answer: Use grep to search the file for info@example.com. Then use grep or awk or whatever to pull out the people who have sent there. Redirect the output to a file.
 
Old 10-21-2011, 07:20 AM   #3
lithos
Senior Member
 
Registered: Jan 2010
Location: SI : 45.9531, 15.4894
Distribution: CentOS, OpenNA/Trustix, testing desktop openSuse 12.1 /Cinnamon/KDE4.8
Posts: 1,144

Rep: Reputation: 217Reputation: 217Reputation: 217
Hi,

try
Code:
$ grep -i -B4 -A4 'example.com' /var/log/maillog
meaning that grep will show 4 lines before matched and 4 lines after matched "string"
from that output paste here to let this modify with some more commands to get exact match you want.

Adjust -B4 and -A4 numbers according to what you see until the result displayed.

Last edited by lithos; 10-21-2011 at 07:21 AM.
 
Old 10-21-2011, 07:20 AM   #4
dikkiedik
LQ Newbie
 
Registered: Aug 2008
Posts: 3

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by AlucardZero View Post
Without giving you the answer: Use grep to search the file for info@example.com. Then use grep or awk or whatever to pull out the people who have sent there. Redirect the output to a file.
Thanks for your quick response, but....

When I do that,. I don't get the from=<email-address> of the sender.
The only thing which is unique for sender and receiver is the messageID.
So I have to filter on that.
My next problem is, how do I remove the messageid and from=<email-sddress> whioch did not send an email to info@example.com?

Kind regards,

Roland
 
  


Reply



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
busybox command works, same command within script says permission denied jeroenv Linux - Newbie 2 01-17-2009 02:58 AM
What does this script command mean? ubume2 Linux - Newbie 3 05-23-2008 02:38 PM
script command shan_nathan Linux - Security 1 01-07-2008 08:00 AM
Help on a command for a script. assasukasse Linux - Newbie 6 06-05-2006 08:36 AM
script command trasher Linux - Newbie 5 02-06-2006 06:20 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:57 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration