I am using Linux.
I have a file of the following format
; Header info
;--+-----+--+----+-+----------------
;Co TASK# ID PROP X Remarks
;de (full desc.)
;--+-----+--+----+-+----------------
AAA P00_1 000Lean - not yet done
AAB P00_2 11 Fat X 20190606
AAC P00_3 1 MidleX canceled
and want it to be converted into this csv file of this format
Code;Task#;ID;PROP;X;Remarks
AAA;P00_1;000;Lean;-;not yet done
AAB;P00_2;11;Fat;X;20190606
AAC;P00_3;1;Midle;X;canceled
Fields are of varying length but maximum length is up to the column of the corresponding '+' -> see line starting with 'AAC' and the field saying 'Midle' for example.
First step would be to determine the columns of the '+'-signs in the header format description and the to inserting a ';' at those columns for each row by respecting the "oversized" fields like "Midle" (see above).
How can I acchieve this with awk or sed or ... under Linux?
Cheers!
FIELDWIDTHS
variable that deals with columnised data. You can create the list of columns from any of the+--
lines. Extracting the headers is too much trouble unless you have many different file sets -- even then I would prefer to hard-code all the header variations and pick one by matching some distinctive feature, to avoid processing arbitrary text.