Hi there,
following problem makes me some headaches:
I have a fixed field length file (SAP IDoc) and needs to extract data. For that I need to define the FIELDWIDTHS variable dynamically. As I had to learn you cannot define the FIELDWIDTHS variable within the actual record
awk ' /E1EDK02/ {FIELDWIDTH="10 5 ..."; print ...}' don't work.
Next idea I had was to define an array to extract the FNR and the belonging record. Then I can refer to array[FNR+1] and set the FIELDWIDTHS variable within the previous record.
Unfortunately, this doesn't work too, because within the array is filled up to the actual record only.
Does anyone has any idea. I'm open to everything. Ideas can be textual.
Many thanks,
Paul.
following problem makes me some headaches:
I have a fixed field length file (SAP IDoc) and needs to extract data. For that I need to define the FIELDWIDTHS variable dynamically. As I had to learn you cannot define the FIELDWIDTHS variable within the actual record
awk ' /E1EDK02/ {FIELDWIDTH="10 5 ..."; print ...}' don't work.
Next idea I had was to define an array to extract the FNR and the belonging record. Then I can refer to array[FNR+1] and set the FIELDWIDTHS variable within the previous record.
Unfortunately, this doesn't work too, because within the array is filled up to the actual record only.
Does anyone has any idea. I'm open to everything. Ideas can be textual.
Many thanks,
Paul.