I have a CSV file of a table that has some entries that are blank. I want my code to look through all the entries for each row (except the first) and count the number of blank entries > store the blank entries per row and separate them with a comma into a file called temp_file > then I want the code to count the number of blank entries in that file and give me a value e.g. if it is,,, then the output should be 3.
This is currently what I have:
sed 1d ${FILENAME} | while read ln
do
echo $ln | tail -1 PMRExceptions.csv | tr "," "\n" | grep -nx '^$' | cut -d":" -f1
PMRNUM=echo $ln | awk -F"," '{print $2}'
PMRMGR=echo $ln | awk -F"," '{print $3}'
COUNT=less $TEMPFILE | wc -l
this part over here is supposed to count the number of blank entries
while read line
do
columns=`head -1 $FILENAME | awk -F"," -v ln=$line '{print $ln}'`
The value that I get is 0, no matter what I change. I think that the entries are not being stored in the tempfile.