17 ms·
Thanks - I've used sort quite a bit, and I like it. I wrote this partly to just fulfil my desire to sort by named fields rather than column indexes.
by johnweldon 9y ago
Thanks - I've used sort quite a bit, and I like it. I wrote this partly to just fulfil my desire to sort by named fields rather than column indexes.
- sigil 9y agoI know the annoyance you're talking about, but I think you're better off wrapping sort(1) with something translates from column names to indexes. Among the reasons: sortcsv buffers all input into memory [1], while sort(1) uses a divide-and-conquer merge sort to avoid this. [1] https://github.com/johnweldon/sortcsv/blob/55818bd8e5f9feeccc242b78acc3f23fd0613b44/main.go#L68 https://github.com/johnweldon/sortcsv/blob/55818bd8e5f9feecc...
- johnweldon 9y agoThat's a good point. I may consider a stand alone utility to wrap this[1] code that converts names to indexes. [1] https://github.com/johnweldon/sortcsv/blob/master/main.go#L104-L118 https://github.com/johnweldon/sortcsv/blob/master/main.go#L1...