Subject: Re: bug#22057: Sort missing feature proposed

From: Assaf Gordon <[email-masked]>
Date: Tue, 1 Dec 2015 09:39:45 -0500

Hello,

> On Nov 30, 2015, at 15:03, Bernhard Voelker <[email-masked]> wrote:
> 
> On 11/30/2015 06:46 PM, Saint Michael wrote:
>> why don't we just go ahead and do it?
> 
> not everything which can be done makes sense to do, and even
> less if the functionality is already there.

Continuing Bernhard's point,
just "going ahead and doing it" is easier said than done - at 141KB of C code, "sort.c" is a complicated program. There are many edge-cases that need to be handled properly, and several non-trivial usage cases.

That being said, a working high-quality patch is worth a thousands words, and if you (or others) implement such a feature, it will make a stronger case for inclusion.

If you do intend to pursue this course, here are some pointers:

This is a sort source code:
  http://git.savannah.gnu.org/cgit/coreutils.git/tree/src/sort.c
Or in a slightly more informative source-code viewer:
  http://lingrok.org/xref/coreutils/src/sort.c

There have been few past attempts at such patches (myself included):
 http://lists.gnu.org/archive/html/coreutils/2010-11/msg00078.html
 http://lists.gnu.org/archive/html/coreutils/2010-11/msg00085.html
 http://lists.gnu.org/archive/html/coreutils/2013-01/msg00027.html

A different approach is writing wrapper-scripts adding the "--header" option
(disclaimer: this one is mine, but there are many other variations out there):
  https://github.com/agordon/bin_scripts/blob/master/scripts/sort-header.in

regards,
 - assaf