We have a service that handles uploading inventory files to different websites for us, keeping them synced. For our own website, we would like to display all available data. The only file format that exports the largest amount of data is UIEE with a .msg extension. It is a text file, not an Outlook file, that has the data in a single column with a header on each delimited by a pipe and then the data, When opened in emacs & vi it shows the lines terminated by ^M and each set of data by a single ^M with no data. Here is an example, but the terminating ^M character is not shown.
User BOOKS 2009-04-09 15:09:34 UR|221162 TI|The Prophet Unarmed; Trotsky : 1921-1929 PR|10.00 AA|Deutscher, Isaac BD|Hardcover NT| blue cloth boards; interior is clean and unmarked; tight binding; 490 pages CO|0 LO|Steel Shelves PC|2.13 SD| CN|Fine PP|London DP|1959 JK|No Dust Jacket PU|Oxford Univ Press XA|4 XB|5 XC|BO XD|S UR|011157 TI|Stirling Moss PR|12.98 AA|Robert Edwards BN|1841882003 BD|Soft Cover with French ... NT|1841882003 Even though this is a brand new book, there is a small vertical (but barely perceptible) crease where the front flap ends. 360 pages; profusely illustrated CO|0 PC|6.49 SD| CN|New PP|United Kingdom DP|2002 KE|AUTOMOBILE RACING BIOGRAPHY DRIVERS SPORTS PU|Weidenfeld & Nicolson XA|4 XB|5 XC|BO XD|S
As you can see, the headers are only present when there is data present in that field, which changes book to book, with the exception of the CO field. For very new record the first header is always the UR field which is our local database SKU and is always unique. This will be linked to the unique key, auto_incremented id field in our online database. The first few rows contain useless file information.
I am really at a loss at how to extract the data on the right of the pipe but keep it referenced to the appropriate header for insertion/deletion/updating into MYSQL database table appropriate field.
I am NOT asking for someone to write the code, but a point in the correct direction would go a long way. I've handled csv & tsv, but nothing like this single column, pseudo repeating header format.
Thanks in advance for any assistance.
Jase

New Topic/Question
Reply



MultiQuote







|