You may consider using AWK with a regular expression in FS variable like this: awk 'BEGIN { FS=",?[ \t]*" ...
stackoverflow.com