mardi 24 février 2015

Transform text from email to table / database

i am receiving log messages to my email which are in following format, something like:



Web.com/15FEB
1GLASS-CUP .ID/123456 .S/CURR USD .S/SUM 001510
1MONEY-WALLET .ID/123457 .X/Q/8/0 .N/447910123456
.S/CURR GBP .S/SUM 002050


followed by more items...


I need to transform those into table and import those into database, so I can cross check those with another tables. So for example in this case the table will look like:



+---------+------+-------------+------+-----+------------+-----+-----+
| Website | Date |Product Name | ID | X | Contact | CURR| SUM |
+---------+------+-------------+------+-----+------------+-----+-----+
| Web.com | 15FEB|GLASS-CUP |123456| | | USD |15,10|
| Web.com | 15FEB|MONEY-WALLET |123457|Q/8/0|447910123456| GBP |20,50|
+---------+------+-------------+------+-----+------------+-----+-----+


If I will manage to convert text into useful format, I can then simply do insert statement and insert those into database and process it. Does anyone how to do this more automatically?


Aucun commentaire:

Enregistrer un commentaire