How can I convert a .out file into a .txt file, CSV, or SQL file? The records present in the .out file do not have delimiters instead each segment in the record has a fixed start and endpoint. Is there an online tool or a simple PHP script in which I can easily define the start and endpoint of each segment? Then, finally, export it with delimiter | between each segment of the record. Not necessarily, if I can directly export this .out file to a sql file.
Records Example:
I299207075410 07 OCCLUSAL-HP LIQ17% LMedicis B000001000000000001EA 8428010080529100 1072363 20030101000000016750000000016750000000000167500200101010000000000000000000000000000000001218000000000000000000000000000000000000000000000000020021231262436018510(W/BRUSH APPLICATOR) TPLIQ
299207085060R01 LUZU CRE1% SBausch C000006000000000001EA 8404080054930829 1 1309011 20180105000000590530000000098421700000000902967000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 TPCRE
P.S. Even blank spaces are part of different segments. Some segments have a length of 1 char; in those blank or space means NULL value.
For example, the first segment has a length of 1 char. As, you can see the 2nd record does not have a value instead a blank space to represent a NULL value.
Please suggest, thank you.
Built on the answer provided here: https://stackoverflow.com/a/62157247/1427345
I developed this bit of code, you will need to modify the
$fieldsvariable with the correct name and length of each column. I just made guesses.Results in: