On Wed, Oct 26, 2005 at 10:09:04AM -0600, Bob Proulx wrote: > Hmm... It works for me. > > printf "one\0two\nabc\0xyz\n" | sort -t "\0" -k2,2 | tr "\000" " " > one two > abc xyz > printf "one\0two\nabc\0xyz\n" | sort -t "\0" -k1,1 | tr "\000" " " > abc xyz > one two
> sort --version [EMAIL PROTECTED] tmp]$ printf "one\0two\nabc\0xyz\n" | sort -t "\0" -k2,2 | tr "\000" " " sort: multi-character tab `\0' [EMAIL PROTECTED] tmp]$ sort --version sort (coreutils) 5.2.1 Written by Mike Haertel and Paul Eggert. Copyright (C) 2004 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. [EMAIL PROTECTED] tmp]$ > This may be a problem with the command shell trying to expand '\0'. > What shell are you using? Can you try the bash shell since it is > known to work in this case? [EMAIL PROTECTED] tmp]$ ps $$ PID TTY STAT TIME COMMAND 4694 pts/6 Ss 1:26 bash [EMAIL PROTECTED] tmp]$ bash --version GNU bash, version 3.00.14(1)-release (i386-redhat-linux-gnu) Copyright (C) 2004 Free Software Foundation, Inc. [EMAIL PROTECTED] tmp]$ > echo sort -t "\0" > sort -t \0 [EMAIL PROTECTED] tmp]$ echo sort -t "\0" sort -t \0 [EMAIL PROTECTED] tmp]$ Of course, "sort -t \0" just expands to "sort -t 0" which means I'm using the character zero as separator. The modified variant: [EMAIL PROTECTED] tmp]$ sort -t \\0 sort: multi-character tab `\0' [EMAIL PROTECTED] tmp]$ To avoid any confusion: this is how it expands: [EMAIL PROTECTED] tmp]$ echo -e \0\\0"\0\\0"'\0\\0' | od -tx1 0000000 30 00 00 00 00 5c 30 0a 0000010 [EMAIL PROTECTED] tmp]$ echo \0\\0"\0\\0"'\0\\0' | od -tx1 0000000 30 5c 30 5c 30 5c 30 5c 30 5c 5c 30 0a 0000015 [EMAIL PROTECTED] tmp]$ > 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. cheers alex _______________________________________________ Bug-coreutils mailing list [email protected] http://lists.gnu.org/mailman/listinfo/bug-coreutils
