|
From: | Matthew Woehlke |
Subject: | Re: [patch] add sort option for IP addresses |
Date: | Mon, 27 Nov 2006 17:16:02 -0600 |
User-agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.8) Gecko/20061025 Thunderbird/1.5.0.8 Mnenhy/0.7.4.0 |
Norbert Kiesel wrote:
I needed to sort some text by IP addresses, and there does not seem to be a good way to do it. They only trick I found was "-n -t. -k1,1 -k2,2 -k3,3 -k4.4" or so, but that is kind of ugly. So I hacked together a patch that adds -I,--ipaddess-sort to sort. It's still incomplete (no IPv6, no manual, possibly configure.in checks needed), but I would work on this if there is a chance that the patch will get added. Comments?
A while back, I posted an RFC [1] about adding "recursive numeric sort" and numeric sort with an arbitrary base. Assuming you want:
10.10.10.1 10.10.10.2 10.10.11.255 127.0.0.1 192.12.12.0 192.14.16.2...etc, then recursive should work, and recursive plus base=16 should work for e.g. MAC addresses (and fully-qualified IPv6 addresses, but not shortened ones e.g. 2001:db8::1428:57ab unless they are all shortened in the same place). The consensus there seemed positive on the coreutils side but less optimistic about my end of copyright assignment. IOW if you want to implement my RFC and can handle assignment, it sounded like it would be accepted (and I would be happy to offer whatever assistance won't get me entangled in copyright problems).
Also, you should work against at minimum the latest stable release (6.6), if not CVS. Working against 5.97 you are likely to run into conflicts.
1: http://lists.gnu.org/archive/html/bug-coreutils/2006-11/msg00020.html -- Matthew This message will self destruct in five millennia.
[Prev in Thread] | Current Thread | [Next in Thread] |