Oct-06-2018, 11:11 PM
I am working on a script and I get an attachment emailed then check for the mail and open the attachment. So far I open it as a text string object from the email and it looks like this:
It can have any arbitrary number of items that will follow the same pattern: Location, Part#, Description, and Curr Qty. My goal from the example would be to end up with a list like this:
I'm thinking I can do my next part of processing easily once I have the list like this. The plan being to feed the data into a template for printing.
I have tried all sorts of splits but I feel stuck because none of them are quite right.
1 2 3 4 5 6 7 8 9 10 11 12 |
Content - Type : application / octet - stream; name = "stockreport.txt" Content - Transfer - Encoding: quoted - printable Content - Disposition: attachment; filename = "stockreport.txt" = EF = BB = BF73558 Lufthansa Technik LTCS - H29&H30 - OSP Fiber Location Part # Description Curr Qty=09 M3B6 RIC - F - SA12 - 01 Fiber Bulkhead - SM / MM - 6 Duplex - 12 Adapters - ST - Black 25 M3B8 RIC - F - LCU24 - 01C Fiber Bulkhead - SM - 12 Duplex - 24 = Adapters - LC - Black / Blue 1 |
1 |
[ '73558' , 'Lufthansa Technik' , 'LTCS - H29&H30 - OSP Fiber' , 'Location' , 'Part#' , 'Description' , 'Curr Qty' , 'M3B6' , 'RIC-F-SA12-01' , 'Fiber Bulkhead-SM/MM-6 Duplex-12 Adapters-ST-Black' , '25' , 'M3B8' , 'RIC-F-LCU24-01C' , 'Fiber Bulkhead-SM-12 Duplex-24 = Adapters-LC-Black/Blue' , '1' ] |
I have tried all sorts of splits but I feel stuck because none of them are quite right.