I am trying to sort some simple pipe-delimited data. However, sort isn't actually sorting. It moves my header row to the bottom, but my two rows starting with 241 are being split by a row starting with 24.
cat sort_fail.csv
column_a|column_b|column_c
241|212|20810378
24|121|2810172
241|213|20810376
sort sort_fail.csv
241|212|20810378
24|121|2810172
241|213|20810376
column_a|column_b|column_c
The column headers are being moved to the bottom of the file, so sort is clearly processing it. But, the actual values aren't being sorted like I'd expect.
In this case I worked around it with
sort sort_fail.csv --field-separator='|' -k1,1
But, I feel like that shouldn't be necessary. Why is sort not sorting?
LC_COLLATE=C sort. Depending on what you're expecting, you may also needLC_COLLATE=C sort -t'|' -ncsvsortfromcsvkit, which properly handles quoted values.