Hello all:

I am using the xsv program for most csv file operations since it is quite fast.

There is one command which I wish it had, called "length" which would give the fields per record (delineated by a line-feed or new line)

awk or gawk does have NF variable and I can use this to verify the integrity of a tab-delimited csv file, quickly and even have awk spit out the bad records which have the field count not matching the expected field count

But awk fails to give the correct NF number if the csv files is comma delimited, since some of the fields can contain quotes to encapsulate a comma inside a string. This misleads awk, of course.

If I try to use xsv to convert a comma delimited file to a tab, it will work if the csv file is valid, but if some record is corrupted, then xsv crashes with an error report. xsv only wants valid csv data.

Does anyone know a validator for "pipe" delimited or "comma" delimited csv files? I need to validate both headered and no-headered csv files.

Thanks for suggesting some quick CLI programs which does this quite well

Randall


Reply via email to