Our mailsystem keeps basic track of users that send attachments to others as our bandwidth is rather expensive (satellite). It informs us by sending a text-based email to us, which we can retrieve and save as a normal .txt-file.

This is how our resulting text-file looks like:

From: SENDER
Sent: 16. juni 2009 14:29
To: RECEIVER
Subject:



[Our Ref:XXXXXXX]

Follow Up Flag: Follow up
Flag Status: Completed

Categories: mlca

REFN: XXXXXXXX INIT:


2009/06/16 09:52:16 COMPUTERNAME User selected to send the mail Ref No: XXX.XXXX
2009/06/16 09:52:16 With Subject: SUBJECTNAME
2009/06/16 09:52:16 No Files: 1 Total size compressed 1617 KB
2009/06/16 09:52:16 * DOCUMENTNAME.pdf-1961KB
From: SENDER
Sent: 16. juni 2009 12:15
To: RECEIVER
Subject:



[Our Ref:XXXXXXX]

Follow Up Flag: Follow up
Flag Status: Completed

Categories: mlca

REFN: XXXXXXXX INIT:


2009/06/16 07:39:06 COMPUTERNAME User selected to send the mail Ref No: XXX.XXXX
2009/06/16 07:39:06 With Subject: SUBJECTNAME
2009/06/16 07:39:06 No Files: 1 Total size compressed 648 KB
2009/06/16 07:39:06 * DOCUMENTNAME.pdf-757KB


What I would like to do is to create a script which can parse this text-file and add all the numbers where it says "Total size compressed XXX KB", but I'm not sure how to get Kix to ignore the rest of the text and only focus on the KB figure.

I'm thinking about something along the lines of using TRIM, but as the position of the value can change, I'm not sure this will work out in the end.

Can anyone point me in the right direction, here?

Thanks in advance!

/Kenneth