Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Microsoft Outlook mail access with AWK

Status
Not open for further replies.

zytalyb

Programmer
Oct 17, 2011
15
DE
Dear all,
I'm new in this forum and also in the AWK Programming and need your help for the following Task:

I need to write an awk script that can be executed in either Windows XP or Windows 7 to parse such a message to extract the following data and write it to a comma-separated value format in this format:
Datetime Value, DATA_1, DATA_2, DATA_3

awk script that will take as its input file an email message that is now automatically generated and sent to me every hour.

Input File:

SQL*Plus: Release 11.2.0.2.0 Production on Thu Jul 12 10:33:01 2011

Copyright (c) 1982, 2010, Oracle. All rights reserved.
SQL> Connected.
SQL> SQL> SQL> SQL> DATA_1
SQL> 2 55555
SQL> DATA_2
SQL> 2 11111
SQL> DATA_3
SQL> 2 22222

So here is what the output text file that should result from running the awk script against the sample message:

Wed Jul 10:33:01 2011 , 555555, 111111, 222222

The Datetime Value is extracted from the tail of the first line of the message body.

I need also to enhance this solution by providing a command button in Outlook I can use, once I highlight such a message, that will execute the awk script against the highlighted message and produce a CSV text file in a separate Notepad window rather than having to deal with a CMD window.

 
What have you tried so far?

I suspect the awk bit will be the easy part!

Annihilannic
[small]tgmlify - code syntax highlighting for your tek-tips posts[/small]
 
Dear Annihilannic,
thanks a lot for your answer,at first, here is the Problem for which I'm looking for a solution:
1- I receive an important mail every hour, that contains some important data that must be formatted and filtered for some definit felds and forward to other department.
The mail message looks like:
SQL*Plus: Release 11.2.0.2.0 Production on Thu Jul 12 10:33:01 2011

Copyright (c) 1982, 2010, Oracle. All rights reserved.
SQL> Connected.
SQL> SQL> SQL> SQL> DATA_1
SQL> 2 55555
SQL> DATA_2
SQL> 2 11111
SQL> DATA_3
SQL> 2 22222

and here is what I want:

Wed Jul 10:33:01 2011 , 555555, 111111, 222222

So, I need an AWK script that can be executed with Win XP or Win7 that gives me the desired results.

Thanks again
 
Yes, I understood that the first time.

But are you going to try and write it yourself, or do you just want someone to write it for you?

Annihilannic
[small]tgmlify - code syntax highlighting for your tek-tips posts[/small]
 
Hi Annihilannic,
because I have no idea about AWK at all, and also because I have no enough time to spent in this task (there are many tasks to do), i think it will be great if anyone who is more experinced than me, write the script for me if possible.
kind regards
zytalyb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top