[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sort feature requests
From: |
Matthew Woehlke |
Subject: |
Re: sort feature requests |
Date: |
Mon, 30 Jul 2007 14:34:36 -0500 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.12) Gecko/20070509 Thunderbird/1.5.0.12 Mnenhy/0.7.4.0 |
Balaji S. Srinivasan wrote:
The coreutils, particularly the text utilities, are an amazing piece of
work and crucial for our group's research efforts at Stanford.
Thank you for taking the time to make this code robust and high quality.
Along these lines, I have a suggestion for a minor improvement. Would it
be possible to add the following features to the next version of GNU sort?
1) Allow the first line of the input to be retained without sorting
(e.g. to keep the header of a tab-delimited text file at the top of the
file)
This should already be possible with a command such as:
$ ( sed 1q ; sort [args] ) < [file]
...however it seems my version of sed (4.1.2-RH4) does not honor POSIX
semantics and consumes too much of the input ('head' from coreutils-6.9
seems to have the same problem?) I did get 'read 4 ; echo $a' to work
however.
(Ok gnulib folks, I don't have any dates handy, is the fseek stuff newer
than coreutils-6.9?)
2) Allow the specification of tabs as separators with the -t option
(this is useful when tab separated fields contain embedded spaces).
Perhaps this is currently possible, but '\t' does not seem to work.
If your shell is reasonable, it will let you enter a literal tab
character. [ctrl]-[v], [tab] seems to work for me (in bash).
There are various ways to achieve this functionality by using shell
scripts or complex pipelines, but it would be great if flags
enabling these features could be added to the next version.
I don't see how either of the above amounts to 'complex pipelines'. The
general philosophy seems to be to not add options when a simple, modular
solution works, therefore I suspect that without greater justification,
neither of these features is likely to be added.
--
Matthew
"...anyway, that's my 0.02 toasters"
(with apologies to Niel)