Useful in (rare) cases like:
$ printf 'aaaa c\nx a\n0 b\n' | sort -k 2,1.3
And this is how POSIX wants it.
---
sort.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
>From 8c82c0f3772a1e657e39ebcb716023d94abd53d3 Mon Sep 17 00:00:00 2001
From: Jakob Kramer <[email protected]>
Date: Sun, 5 Apr 2015 21:36:04 +0200
Subject: [PATCH 4/4] sort: allow keys where start_col > end_col
Useful in (rare) cases like:
$ printf 'aaaa c\nx a\n0 b\n' | sort -k 2,1.3
And this is how POSIX wants it.
---
sort.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sort.c b/sort.c
index 3697b42..901189e 100644
--- a/sort.c
+++ b/sort.c
@@ -157,7 +157,7 @@ parse_keydef(struct keydef *kd, char *s, int flags)
return -1;
if (*rest == ',') {
kd->end_column = strtol(rest+1, &rest, 10);
- if (kd->end_column && kd->end_column < kd->start_column)
+ if (kd->end_column < 1)
return -1;
if (*rest == '.') {
kd->end_char = strtol(rest+1, &rest, 10);
--
1.9.1