Skip to end of metadata
Go to start of metadata

If you find yourself with a csv file with an uneven number of fields in each line a new option for csv-fields may help.

csv-fields make-fixed will make every line have the same number of fields by adding fields to short lines or, with the --force option, stripping fields from long lines.

For example:

$ { echo "a,b,c,d"; echo "x,y,z"; } | csv-fields make-fixed --count=6
a,b,c,d,,
x,y,z,,,
$ { echo "a,b,c,d"; echo "x,y,z"; } | csv-fields make-fixed --count=3 --force
a,b,c
x,y,z

If you try to crop a line without the --force option then the application will fail.

  • No labels