user3753693 user3753693 - 11 days ago 5x
Bash Question

CSV find blank value in third column KSH

Hi my data set is simple as show below


I am trying to use awk or grep to count the rows in which there is a blank in the third colmn. In this case it would be 1 since only the middle one has a blank in the column so far what i have tried is below. The login is trying to use awk to search for a blank string then count it the same with grep find where there is a blank in the third column then count it.

COUNT=$('awk '' $DATAFILE | wc -l')
COUNT=$('grep -e '.*,.*,,' $DATAFILE' | wc -l)

awk -F, '$3==""{c++} END{print c+0}' file