
mrsaqib
Novice
Oct 12, 2009, 11:24 AM
Post #1 of 2
(5557 views)
|
Extract email from txt file
|
Can't Post
|
|
hi there i have a requirement, i need to extract sender' e-mail address (From:) from following file, File 'file.txt' is as under: ==================== From root@localhost.localdomain Fri Oct 9 06:02:09 2009 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 n991283v009188 for <saqib@localhost>; Fri, 9 Oct 2009 06:02:08 +0500 Message-Id: <200910090102.n991283v009188@localhost.localdomain> MIME-Version: 1.0 Content-Transfer-Encoding: binary Content-Type: multipart/mixed; boundary="_----------=_125505012891870" X-Mailer: MIME::Lite 3.025 (F2.74; T1.28; A2.03; B3.07; Q3.07) Date: Fri, 9 Oct 2009 06:02:08 +0500 From: root@localhost.localdomain To: saqib@localhost.localdomain Subject: This is the message subject Status: O This is a multi-part message in MIME format. --_----------=_125505012891870 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain This is the message body --_----------=_125505012891870 Content-Disposition: attachment; filename="mario.jpg" Content-Transfer-Encoding: base64 Content-Type: image/jpeg; name="mario.jpg" ................................................................................................................... so on * Note : i need only from address i.e, root@localhost.localdomain Can someone kindly help me to extract the 'From' email address. I will be really thankful to you.
|