xsv fixlengths data.csv

Category: Data Science & Analysis

xsv fixlengths data.csv

Pad or truncate rows to a uniform field count

The fixlengths command forces every row to have the same number of fields, padding short rows with empty fields and truncating long ones. Ragged rows from hand-edited spreadsheets otherwise break stats and join operations. The output is a clean rectangular table ready for analysis. Run datamash check first to see how bad the damage is.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.