Generic Data validator
Data file:
Name,Sal,Dept
ABC,1234,D1
AYX,12356,D2
DHF,345,ED3
123,4565,FGJG
Config File:
Delimiter-","
Rule1-Name-[:upper:]
Rule2-Sal-[:digit:]
Rule3-Dept-[D]*
Can be used to match any regex including date different format and numbers.
Depending on the Delimiter the file would be read.
The validator would check for the columns against the regex for each column specified.
If any column record doesnt match then the row should be flagged with the related rule no for the failure
Eg.
DHF,345,ED3(doesnt begin with D),Rule3
if multiple failure then
123,4565,FGJG,Rule2;Rule
What would be the best coding language awk or perl?
Examples would be appreciated
---------- Post updated at 02:42 PM ---------- Previous update was at 02:32 PM ----------
Post validation,we might have a requirement to convert the columns to format as specifier in the config.
Config File:
Delimiter-","
Rule1-Name-[:upper:]
Rule2-Sal-[:digit:]-0.00
Rule3-Dept-[D]*
Data File Output:
Name,Sal,Dept
ABC,1234.00,D1
AYX,12356.00,D2
DHF,345,ED3,Rule3
123,4565,FGJG,Rule2;Rule3
Notice the Sal column has changed to 1234.00 from 1234
Regards,D
Dikesh Shah.