I require some help in reading and updating a csv file using Shell script. I have written the below code to read the csv file and it works fine.
#!/bin/sh
#This script is to read the excel data
IFS=","
echo "Starting to read csv"
i=1
while read f1 f2
do
test $i -eq 1 && ((i=i+1)) && continue
echo "tenantID is :$f1"
echo "status is :$f2"
#The below command will update the schema with data
java -Xmx512m -XX:MaxPermSize=128m -jar biz.jar -install -readers=seed - delegator=default#$f1
done < TenantId.csv
echo "end of file "
The above code is working fine. I.e it reads the csv file and passes the tenantID to the java arg. Once the java processing is done, I would like to update the status(f2) with some values. Also in the above code,blank lines are also getting executed.I would like to know how to process only the lines where data is present. Please let me know how to acheive the same.
Thanks in Advance