Count number of column in a comma delimited file

view full story

http://www.unix.com – I have a comma (,) delimited file. Code: 106232145,"medicare","medicare,medicaid",789 I would like to count the number of fields in each line. I tried the below code Code: awk -F ',' '{print NF-1}' This returns me the result as 5 instead of 4. This is because the awk takes "medicare,medicaid" as two different fields instead of one field.:wall: **In my file, the text field qualifier is "(double quotes) Please help me with this. (HowTos)