My CSV data looks something like this ->
Header1 Header2
Key100 Value100
Key200 Value200
It has only two columns with Header as first row. The columns are keys and respective values. Now, my requirement is -
- I want to store key & value as String data type
- Need to exclude the Header(the first row) while storing
- Need to exclude null or " " keys
- it is a ',' separated data
- The word "Data:" should be appended to each key while inserting.
For example - for the above provided csv data, redis should store as -
Data:Key100
Data:Key200
Result:
When I do get Data:Key100 my output should be : "Value100"
Have tried with awk command but it is keep on giving error - invalid stream id specified
awk -F ',' 'FNR > 1 {print "XADD myStream \""($1=="" ? "NA" : $1)" column_1 "($2=="" ? "NA" : $2)" column_2 ... \n"}' data.csv | redis-cli --pipe
Please help me to get the command. Thank you