LinuxQuestions.org
Review your favorite Linux distribution.
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 10-13-2012, 04:25 PM   #1
NickPats
Member
 
Registered: Oct 2012
Posts: 43

Rep: Reputation: Disabled
to figure of total num of msgs


num:2
Subject: Re: Fun tomorrow
To: williams123@hotmail.com (Jack Williams)
From: Me
TimeStamp: 02/01/2004 at 11:19:02
Sent: yes

...this is one of those mail. want to output 2 things. name where it sent and then total msgs sent there. I printed out the name . how can i find total msg sent there. Any help would be appreciated. Thanks.
 
Old 10-13-2012, 04:37 PM   #2
mmheera
Member
 
Registered: Oct 2012
Location: Germany
Distribution: Ubuntu, Debian, Fedora,Windows 7
Posts: 107

Rep: Reputation: 11
It is not very clear from your email what exactly you are trying to do. Please make it more elaborate. What OS and software you are using? From where are you trying to get the information, if an email server, which one?
 
Old 10-13-2012, 04:43 PM   #3
linux-sys-adm
LQ Newbie
 
Registered: Oct 2012
Distribution: ArchLinux
Posts: 13

Rep: Reputation: Disabled
What OS?

Last edited by linux-sys-adm; 10-13-2012 at 05:12 PM.
 
Old 10-13-2012, 04:59 PM   #4
NickPats
Member
 
Registered: Oct 2012
Posts: 43

Original Poster
Rep: Reputation: Disabled
i am using mac os. in the 3rd line there is a name. That every email that sent from the server has. print out that name. there are thousands msgs. but i am first testing data on small section. so if there are two msgs sent to Jack Williams. want to print out like. "Jack Williams 2" .
 
Old 10-13-2012, 06:50 PM   #5
NickPats
Member
 
Registered: Oct 2012
Posts: 43

Original Poster
Rep: Reputation: Disabled
How can i print just the name? from the line 3. the text between ()'s .

Last edited by NickPats; 10-13-2012 at 06:52 PM.
 
Old 10-14-2012, 04:31 AM   #6
mmheera
Member
 
Registered: Oct 2012
Location: Germany
Distribution: Ubuntu, Debian, Fedora,Windows 7
Posts: 107

Rep: Reputation: 11
You can collect this type of data from the SMTP or mail server. Most of the SMTP server have some sort of logging scripts to collect data about the email sent/received. You may check your respective mail server software documentation. Which email server you are using anyway?
 
Old 10-14-2012, 05:27 AM   #7
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
If all this text you've mentioned here is stored in some file, let's say some messagelogfile.txt then do as:

more messagelogfile.txt | grep -w "To" | awk -F" " '{print $3,$4}' | sed 's/(//g' | sed 's/)//g'

It will give you a list of all reciepent's full names.
Furhter, share some example, or some samplpe mail message so I can suggest some commands.

Last edited by shivaa; 10-14-2012 at 05:40 AM.
 
Old 10-14-2012, 11:00 AM   #8
NickPats
Member
 
Registered: Oct 2012
Posts: 43

Original Poster
Rep: Reputation: Disabled
309/prob309264_03:To: darkman1425@aol.com (Greg)
405/prob405823_20:To: vicmurai@hotmail.com (Anne Murai)
405/prob405823_22:To: vicmurai@hotmail.com (Anne Murai)
422/prob422532_07:To: thrill_seeker86@hotmail.com (John-Paul)

it has this kinda msgs.
 
Old 10-14-2012, 11:17 AM   #9
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
Quote:
Originally Posted by NickPats View Post
309/prob309264_03:To: darkman1425@aol.com (Greg)
405/prob405823_20:To: vicmurai@hotmail.com (Anne Murai)
405/prob405823_22:To: vicmurai@hotmail.com (Anne Murai)
422/prob422532_07:To: thrill_seeker86@hotmail.com (John-Paul)

it has this kinda msgs.
No problem, save it in some file, let say file.txt, and then invoke:
more file.txt | awk -F" " '{print $3,$4}' | sed 's/(//' | sed 's/)//'

Or if this output, you mentioned, is coming from some command, then do as:
<command-generating-your-output> | awk -F" " '{print $3,$4}' | sed 's/(//' | sed 's/)//'
 
  


Reply


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
how can grep from file (num num) (num num) ? DoME69 Programming 2 11-07-2011 07:56 AM
msgs in message log newio Slackware 8 12-12-2006 08:56 AM
retrieving msgs during boot mathfeel Linux - Software 2 02-19-2005 10:26 PM
Can I pause the boot up msgs? snatale1 Mandriva 2 01-03-2004 02:59 AM
half life server? Total Newbie Can't figure out bin files Facekhan Linux - Newbie 7 08-20-2003 11:45 AM


All times are GMT -5. The time now is 10:30 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration