I have this data in my file
65 ---
66 FieldType: Text
67 FieldName: STATE
68 FieldNameAlt: STATE
69 FieldFlags: 4194304
70 FieldJustification: Left
71 FieldMaxLength: 2
72 ---
73 FieldType: Text
74 FieldName: ZIP
75 FieldNameAlt: ZIP
76 FieldFlags: 0
77 FieldJustification: Left
78 ---
79 FieldType: Signature
80 FieldName: EMPLOYEE SIGNATURE
81 FieldNameAlt: EMPLOYEE SIGNATURE
82 FieldFlags: 0
83 FieldJustification: Left
84 ---
85 FieldType: Text
86 FieldName: Name_Last
87 FieldNameAlt: LAST
88 FieldFlags: 0
89 FieldValue: Billa
90 FieldJustification: Left
91 ---
How can i make that a array and store as key value pair in array like
array['fieldtype']
array['fieldName']
for all the objects.
i think the separater is only “—” but i don’t know how can i do that
Here’s one way with GNU awk. It splits the input into records which can then be worked on.
parse.awk
Save the above into parse.awk and run it like this:
Where
infilecontains the data you want to parse. Output: