[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: multi-character tab

From: Bob Proulx
Subject: Re: multi-character tab
Date: Wed, 26 Oct 2005 23:17:38 -0600
User-agent: Mutt/1.5.9i

Alex van den Bogaerdt wrote:
> address@hidden tmp]$ printf "one\0two\nabc\0xyz\n" | sort -t "\0" -k2,2 | tr 
> "\000" " "
> sort: multi-character tab `\0'
> address@hidden tmp]$ sort --version
> sort (coreutils) 5.2.1

Thanks for the additional information.  This is not broken in the
upstream sources.  It is also not broken in another distribution of
the same version.  Therefore I can only deduce that it must be a
problem with a patch applied by your software distribution on top of
the upstream sources.  If you wish to pursue this further you will
need to file a bug with your distribution.  Or compile your own
version from the GNU sources.

The latest stable release of the GNU coreutils is available here:

  ftp://ftp.gnu.org/gnu/coreutils/coreutils-5.92.tar.gz   (7.2MB)
  ftp://ftp.gnu.org/gnu/coreutils/coreutils-5.92.tar.bz2   (4.6MB)

That is a very latest stable release.  Please report any problems that
you may find with it.

> >   echo sort -t "\0"
> >   sort -t \0

Looks good.  I was a little concerned that the shell had done
something interesting to the "\0" there.  But that looks fine.

> Of course, "sort -t \0" just expands to "sort -t 0" which means I'm using the
> character zero as separator.  The modified variant:
> address@hidden tmp]$ sort -t \\0

Personally I find "\0" and '\0' easier to read than \\0.  But they all
should be the same.

> > In all cases the scheme creates the tab first and then uses it in the
> > sort with a variable such as "sort -t $TAB".
> Ack.  I'll stick to TAB=$(echo -ne \\t) then.  Thanks anyway for answering.

Using 'echo -ne' is probably the *worst* of the alternatives.  It is
about as non-portable as it can get.  I am cringing just looking at it.

I strongly recommend using one of the alternatives that does not
depend so heavily upon particular behavior of the shell.  Best if it
only depends upon standard features.  Please use 'printf' at the
least!  Then there is a chance that it will work across POSIX shells.

    TAB=$(printf "\t")


reply via email to

[Prev in Thread] Current Thread [Next in Thread]