validation - parsing & validating csv data file using unix scripting -
i have basic knowledge on unix shell scripting(not expert).
my requirement reading csv file using schema defined in configuration file , if condition not mached drop records.
in brief: here i'm defining schema of input file in normal text file , i'm calling configuration file. configuration file looks : col1 integer nn col2 string col3 string nn
also i'm having data file ( .csv file) , looks :
id,name,location 1,john,fl
2,merry,,
3,taylor,ca
a,george,mi
so here need write unix sript such way while reading csv data file ,it should refer configuration file datatype , whether field null or not. if not satisfying condition should drop whole record , move next row validation check.
here expected result :
id,name,age
1,john,fl
3,taylor,ca
rest of records dropped because :
2,merry,, ---> here 3rd filed null in configuration file not null(nn)
a,george,mi --> here 1st field value string in conf file integer.
so how achieved in unix script , commands need used this.
please let me know if scenario not clear.
thanks, shree
Comments
Post a Comment