[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: why aren't gnu utils normalized?
From: |
Barry Margolin |
Subject: |
Re: why aren't gnu utils normalized? |
Date: |
Mon, 31 Aug 2009 16:36:58 -0400 |
User-agent: |
MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) |
In article <6sRmm.108300$nL7.58427@newsfe18.iad>,
Hyman Rosen <hyrosen@mail.com> wrote:
> Alan Mackenzie wrote:
> > Does it actually fail to work? What happens instead?
>
> Yes, it actually "fails" to work. Given these inputs
>
> File "a": File "b":
> 2 a 1 a
> 10 b 10 b
>
> the command "join a b" produces no output. The OP would
> like "join" to take the same commands to specify the sort
> order of the join column that the "sort" command takes in
> order to sort columns, rather than requiring the join
> column to be sorted in lexical order.
I think the answer to his general question, then, is that it would take
an enormous amount of work to get all commands to be consistent this
way. There are lots of commands that work on similar kinds of data, and
they each have options that are specific to what they do, as well as
some options that are more general. Reconciling all of these, including
dealing with some of the conflicts (especially with traditional
single-letter options) would be a huge undertaking.
Traditionally, the Unix model has been to NOT try to replicate all these
options in every command. The Unix Way is to have a toolkit of
specialized commands, which can be combined to produce the results you
want.
So if you have two files that are sorted numerically, and want to join
them, you first run them through sort(1) to re-sort them
lexicographically, then run those through join, and finally sort the
result numerically.
In some cases, certain combinations have become so common that
developers have relented and added features to one of the commands. For
instance, tar is used so often with compressed and gzipped archives that
they decided to add -Z and -z options to GNU tar (this is especially
useful in combination with GNU tar's ability to write to remote servers
via rsh/ssh -- this is complicated to do using CLI pipes). I guess
there haven't been enough users running into this issue with join that
anyone felt the need to give it all of sort's capabilities.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***