[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Sorting on compound keys?
From: |
Tim Landscheidt |
Subject: |
Sorting on compound keys? |
Date: |
Tue, 24 May 2011 20:57:03 +0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
Hi,
sometimes I want to sort unified diffs of CSV files (sepa-
rated by tabs (here: \t)):
| +A 1\t1\tx
| +A 1\t2\ty
| +B 2\t3\tz
| -A 1\t1\tx
| -B 2\t2\ty
| -B 2\t3\tz
by the second column, then the first column, then "+" vs.
"-". Unfortunately, it seems that sort-regexp-fields doesn't
allow more than one match field as a key. sort-fields
doesn't work either as it requires the fields to be sur-
rounded by white space (no "+" vs. "-") and doesn't allow
white space inside the fields.
Is there any function in vanilla Emacs (23.1.1) that I
missed? I looked at pimping sort-regexp-fields, but it seems
to me that sort-subr would have to be rewritten from scratch
to achieve sorting on compound keys.
Tim
- Sorting on compound keys?,
Tim Landscheidt <=
Re: Sorting on compound keys?, Mark Tilford, 2011/05/29