$ perl -ne 'print tr/,//, "\n"' < file.csv | sort -u
Sometimes I need to know if a CSV file has the right number of columns, and how many columns there are.
This one-liner does not handle the more general case when the columns may have embedded commas within quotes. For that you would need a more sophisticated method. This simple version can still be very useful in many common cases.