LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   extracting a particular mail (https://www.linuxquestions.org/questions/linux-newbie-8/extracting-a-particular-mail-867734/)

dinakumar12 03-10-2011 10:25 AM

extracting a particular mail
 
hi all,

I just want to know is it possible to extract a single mail from the mail path i.e. /var/mail/root.

for ex. i am having this mail in /var/mail/root.


From root@localhost.localdomain Thu Mar 10 21:47:47 2011
Return-Path: <root@localhost.localdomain>
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by localhost.localdomain (8.13.8/8.13.8) with ESMTP id p2AGHlx4004190
for <root@localhost.localdomain>; Thu, 10 Mar 2011 21:47:47 +0530
Received: (from root@localhost)
by localhost.localdomain (8.13.8/8.13.8/Submit) id p2AGHlD5004189
for root@localhost.localdomain; Thu, 10 Mar 2011 21:47:47 +0530
Date: Thu, 10 Mar 2011 21:47:47 +0530
From: root <root@localhost.localdomain>
Message-Id: <201103101617.p2AGHlD5004189@localhost.localdomain>
To: root@localhost.localdomain
Subject: new

company test
requirement newinstance

XXXXXXXXXXXXXXXXXXXX

how to extract only this mail from /var/mail/root

can we do that with the help of date and time for that particular email.

if possible whats the code your suggestions please.

Your suggestions please.


Thanks&regards,
Dinesh.

corp769 03-10-2011 11:15 AM

You could probably use sed and cut for something like that, using date and time like you said.

dinakumar12 03-10-2011 11:57 PM

hi,

yes,but can i get the exact code for that, i am also searching for this, mean while if any one got the code kindly post it.


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