> I'd like to use a bash command to sort a file by a certain field in that
> I've looked at sort but I can't see how to do it - interestingly, the
> docs say the -t option is for specifying a delimiter, but then I can't
> see anything else obvious about saying which field you'd like to sort by!
> If sort can't do this directly, I'm sure something is possible using cut
> + sort together, but the exact form eludes me at the moment!
Well, I thought to try using a cut either side of a sort, to reorder the
fields so that the field I want to sort by was at the front (and then
another cut after the sort to put the order back to normal), but cut
won't allow re-ordering of fields apparently!
cut -d , -f 1,2 file.txt
cut -d , -f 2,1 file.txt # note swapped order of fields
.. hmm, same order output each time!