How to parse text file (.eml) to get index of line, that contains Subject, From field, and base64 decoded Body

Hello, Dear Colleagues.
Help me please with next deal.
As input I have .eml file:
x-sender: [email protected]
x-receiver: ***************************
Received: from ***** with Microsoft SMTPSVC(7.5.7601.17514);
Fri, 20 Mar 2015 12:43:03 +0200
In-Reply-To: <********@LocalDomain>
To: *****************************
Bcc:
Subject: Incident ID#: 117 Something wrong, something right, something missing
Message-ID: <*****************************@LocalDomain>
From: [email protected]
Date: Fri, 20 Mar 2015 12:42:55 +0200
Content-Type: multipart/related; boundary="=_related ********************"
References: <*******************************C@LocalDomain>
MIME-Version: 1.0
X-KeepSent: ****************************; name=$KeepSent; type=4
X-Mailer: Lotus Notes Release 8.5.2FP3 July 11, 2011
X-Disclaimed: 54023
Return-Path: [email protected]
X-OriginalArrivalTime: 20 Mar 2015 10:43:03.0590 (UTC) FILETIME=[A48E9C60:01D062FA]
--=_related **********************=
Content-Type: multipart/alternative; boundary="=_alternative &**************"
--=_alternative ******************
Content-Type: text/plain; charset="KOI8-R"
Content-Transfer-Encoding: base64
U29tZXRoaW5nIHdyb25nLCBzb21ldGhpbmcgcmlnaHQsIHNvbWV0aGluZyBtaXNzaW5nDQpTb21l
dGhpbmcgYmxhY2ssIHNvbWV0aGluZyBsaWdodCwgc29tZXRoaW5nIGRpZmZlcmVudA0KRG9uJ3Qg
eW91IGV2ZXIgZmVlbCB5b3UgbmVlZCB0byBzcGVhayB0byBtZSB0aGF0IHdheT8NClNvbWV0aGlu
ZyBibGFjaywgc29tZXRoaW5nIGxpZ2h0LCBzb21ldGhpbmcgZGlmZmVyZW50DQpTb21ldGhpbmcg
d3JvbmcsIHNvbWV0aGluZyByaWdodCwgc29tZXRoaW5nIG1pc3NpbmcNCkRvbid0IHlvdSBldmVy
IGZlZWwgeW91IG5lZWQgdG8gc3BlYWsgdG8gbWUgdGhhdCB3YXk/IA==--=_alternative ******************
Content-Type: text/plain; charset="KOI8-R"
Content-Transfer-Encoding: base64
Because position of lines changes due to email type, as output I want to get:
1). index of line that contains: Subject, i.e. "Subject: Incident ID#: 117 Something wrong, something right, something missing"
2). index of line that contains "From", i.e. "From: [email protected]"
3). base64 - decoded text (body of email)
Thanks for your help.
Have a nice day.

jrv,
your script, unfortunately, always return "String not found".
Because you file is probably not constructed the same as the copy you posted.  I was just showing you how.  You will need to adjust to the actual file.
Outlook can open and convert  EML files. 
¯\_(ツ)_/¯

Similar Messages

  • How to parse text file?

    Hi,
    I would like to read data from a text file that my program has created.
    This is what I have when I create my file:
    try
                   File file = new File("/Users/seifmouelhi/Desktop/Output.txt");
                   FileOutputStream out = new FileOutputStream(file);
                   PrintStream print = new PrintStream(out);
                   System.setOut(print);
              catch(Exception e)
                   System.out.println("set system out failed!!!!!");
                   System.out.println(e.toString());
                   System.exit(0);
    and what can I use to parse this file?
    every word is separated with a "\t". I used MyString.split("\t"), but is returns me back null value...
    What can you advise me?
    Thanks a lot!

    Well, here is the short code:
    private static int aX;
    private static int X;
          * @param args
         public static void main(String[] args) {
              BufferedReader entree = new BufferedReader( new InputStreamReader(System.in));
              String cmd = "";
              String type="";
              try {
                   cmd = entree.readLine();
                   String[] res = cmd.split("\t");
                   if(res[0]=="accelero"){
                        type="accelero";
                        aX = Integer.parseInt(res[1]);
                   else if(res[0]=="touch"){
                        type="touch";
                        X = Integer.parseInt(res[1]);
                        System.out.println("touch:"+X);
                   else if(res[0]=="0.0"){
                        type="data";
                   System.out.println(type);
                   System.out.println("accelero:"+aX);
              } catch (IOException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              String[] rix = cmd.split("\t");
         }when you try this code, you should write (for example): accelero 35
    there is a \t between accelero and 35, and I want the system to print accelero, and 35 once the full string was split.
    System.out.println(type); --> prints nothing
    System.out.println("accelero:"+aX); --> prints accelero:0
    I want simply to use the res. It seems like the string.split doesn't work in this example.

  • How to read text file line by line...?

    how to read text file line by line, but the linefeed is defined by user, return list of string, each line of file is a item of list?
    please help me.
    Thanks very much

    Brynjar wrote:
    In Groovy, you would do something like:
    linefeed = "\n" //or "\r\n" if the user chose so
    lines = new File('pathtofile').text.split("${linefeed}")This is one of the things that has always annoyed me about Sun's sdk, i.e. the lack of easy ways to do things like that. You always end up making your own utilities or use something like Apache's commons.io. Same goes for jdbc and xml - I'll wait for appropriate topics to show how easy that is in Groovy :)I generally agree, but what I really don't like about the Groovy text-file handling niceties: They don't care about encoding/always use the default encoding. And as soon as you want to specify the encoding, it gets a lot more complex (granted, it's still easier than in Java).

  • How to write text file in Shockwave?

    Does anybody know how to write text file in Shockwave to
    user's disk?
    Thanks in advance.

    Those Xtras can wreak to much havoc when used with the wrong
    intent.
    What you can do is write with setpref and store a list of
    saves and the
    saves itself seperatly. Then you'd have to build your own
    save/open
    dialog to let the user:
    * pick a previously saved file to load or overwrite
    * have the user type the name of a new file to save.
    Only thing that remains is that the user cannot decide where
    the files
    are saved.
    Manno
    SiuLinda wrote:
    > Thanks a lot for your reply.
    > Yes, cookies is good but I have to write a program to
    save the text file in
    > where the user wants, user can open these files later if
    they like, like using
    > Filextra and Fileio, but I found all of these xtras seem
    to be not supported in
    > shockwave.
    >
    Manno Bult
    [email protected]

  • How to parse json files

    Hi
    Can anyone help with some In depth tutorials on how to parse json files locally (in the project folder) and online (webservice) in WP8 development
    Thank you in advance
    Jayjay john

    1. Build up a strong type class for this json
    Visual Studio 2013 Hidden Gem: Paste JSON or XML as C# Classes
    2. use Json.Net to Deserialize , like:
    var result = Newtonsoft.Json.JsonConvert.DeserializeObject<yourdatatype>(jsonstring);
    Working with JSON in C#
    在現實生活中,你和誰在一起的確很重要,甚至能改變你的成長軌跡,決定你的人生成敗。 和什麼樣的人在一起,就會有什麼樣的人生。 和勤奮的人在一起,你不會懶惰; 和積極的人在一起,你不會消沈; 與智者同行,你會不同凡響; 與高人為伍,你能登上巔峰。

  • How to load text file data to Oracle Database table?

    By using Oracle Forms, how to load text file data to Oracle Database table?

    Metalink note 33247.1 explains how to use text_io as suggested by Robin to read the file into a Multi-Row block. However, that article was written for forms 4.5 and uses CREATE_RECORD in a loop. There was another article, 91513.1 describing the more elegant method of 'querying' the file into the block by transactional triggers. Unfortunately this more recent article has disappeared without trace and Oracle deny its existence. I know it existed as I have a printed copy in front of me, and very useful it is too.

  • How to load text files in GUI

    plz tell me .. how to load and compare two text files using file popup's . example file i have attached..
    Attachments:
    testW_FF.txt ‏2 KB

    I don't understand whether your question is on how to load text files or how to show them on a panel or how to compare them... or all aspects together!
    The first operation (loading the file) can be accomplished with functions included in the Formatting and I/O Library like OpenFile, ReadFile and so on; with a file like yours even FileToArray could be an option.
    How to show the data on screen is heavily dependent on what you intend to do with them: data can be shown in textboxes, listboxes, tables or graphs so... what do you want to do?
    The same applies with comparison: without additional details is difficult to give you the proper hint.
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • Step by Step"How JSP read text file :

    Hi ,
    Any one know or have a good site to show step by step how JSP read text file.
    TQ.

    There is no difference Between reading a text file from JSP and reading a text file from Java.
    Just follow the same steps for JSP also.

  • HT4623 When I plug my ipad to itunes i get the error message that it is not supported and I have to go to itunes and get itunes re-installed?  i never had this problem before.  if i do this will i loose all my files, music, etc?

    When I plug me ipad to itunes i get the error message that it is not supported and that i have to go to itunes and get "itunes installer" and re-install.  if i do this will i loose my files and music?

    No, you should not lose anything.

  • I recieved an Adobe Master Collection License number from my school (Stevens Institute of Technology) and I can't figure out how to use it in order to get the product. I've created a username and that's as far as I've gotten.

    I recieved an Adobe Master Collection License number from my school (Stevens Institute of Technology) and I can't figure out how to use it in order to get the product. I've created a username and that's as far as I've gotten. I need to download the product and I can't figure out where to begin.

    Ask someone at your school... Do you have a Cloud redemption code, or a CS6 serial number?
    If Cloud, Redemption Code http://helpx.adobe.com/x-productkb/global/redemption-code-help.html and
    http://www.adobe.com/products/creativecloud/faq.html
    http://helpx.adobe.com/creative-cloud/help/install-apps.html to install or uninstall
    http://forums.adobe.com/community/download_install_setup/creative_cloud_faq
    What it is http://helpx.adobe.com/creative-cloud/help/creative-cloud-desktop.html
    Cloud Getting Started https://helpx.adobe.com/creative-cloud.html
    If CS6, download at Other downloads and enter your serial number when prompted
    Again... your 1st resource is your school

  • My hard drive failed so I sent it off to get recovered. How can I get my music back that I purchased from my old iTunes account?

    My hard drive failed so I sent it off to get recovered. How can I get my music back that I purchased from my old iTunes account?

    See Downloading past purchases from the App Store, iBookstore, and iTunes Store

  • How can I get rid of photos that were downloaded from my computer?

    How can I get rid of photos that were downloaded from my computer?  I need to free up space on my iPad

    Assuming that you synced the photos from iTunes - or whatever downloaded means - you must use iTunes again in order to remove the songs from the iPad. You have to uncheck the albums in the photos folder that you sync from in the Photos tab of iTunes and follow that with a sync.

  • HT1527 when I try to download apps in my iphone , i get a spinning circle that won't go away and a icon that is gray and says "waiting". Any ideas how to solve?

    When I try to download apps in my iphone , I get a spinning circle that won't go away and a grey icon that says "waiting" .Any ideas how to fix the problem?

    First go into settings, Itunes and App store,  sign out and then sign in again! (This might not work)

  • How can I get my pics back that were deleted from icloud?

    How can I get my pics back that were deleted from icloud?

    Read this:
    http://support.apple.com/kb/HT1414

  • How do I open .cwk files sent to me on my iPad that contain graphics

    How do I open .cwk files sent to me on my iPad that contain graphics?

    No.
    Apple works was abandoned many years ago.

Maybe you are looking for

  • Using SKPTSMTPMessage how to send a variable String?

    I am using SKPTSMTPMessage to send an email in the background but I need to send a variable string. I have tried putting a %@ in the text but it just sends the %@ and not a variable. Please Help? Hopefully, iCrazy23

  • Problem with  ms word for mac 10.6.8 with mac OSX 10.6.8

    I am using ms word mac 10.6.8 with mac OSX 10.6.8 and two times now I have edited a document, tried to save it and it froze up.  The error message is "command is not available b/c the document is in modal state"  Any suggestions?

  • Nokia 6280 Theme & Profile (PICK ONE ONLY)

    I bought the phone for less than couple months, and I always found that the ringtone change back to default one. Definitely, not the one I saved within the profile. Nokia TRIED to fix mentioned problem twice for me (reinstall the firmware and change

  • Prividers Not working exception thrown

    We are using Baltimore Providers for security . While it workd fine in applet viewr / application , I failed to make it run in browser (IE 6) with jre 1.4.2 . What may go wrong ? We used digital signature for data signning . Any help or pointers will

  • Importing from pages or numbers

    Is it possible to import files to keynote from pages or numbers. I am working on a safety presentation that uses spreadsheets, photos and graphics (lines, arrows, comments in text boxes etc) I would like to be able to present this as a keynote or pow