Re: tab as sort's field-separator

2002-06-16 Thread Andrew D Jewell

What you've got here is a shell problem, not a sort problem.

Although I'm sure I've done it in the past, I can't at the moment 
figure out how to make it happen in tcsh.

One option is to grab the improved textutils from
http://alexautils.sourceforge.net
where all field based tools have '--dt' to specify what you want, as 
part of the Alexa standard :

   --dw   shortcut for the inexpressible --delimiter=WHITESPACE
   --dz   shortcut for --delimiter=ZERO
   --ds   shortcut for --delimiter=SPACE
   --dt   shortcut for --delimiter=TAB
   --De   shortcut for inexpressible --output-delimiter=EMPTY
   --Dz   shortcut for --output-delimiter=ZERO
   --Ds   shortcut for --output-delimiter=SPACE
   --Dt   shortcut for --output-delimiter=TAB


I supposed some sort of tcsh command of the form
/bin/bash -c 'that sort command that wors in bash'
might work.

adj


At 2:26 AM -0400 6/15/02, Jim Fohlin wrote:
>Hi,
>
>It appears that one can't specify just a tab (a tab and only a tab) as
>sort's field-separator.  As shown below, the UNIX example does it
>right whereas the Linux example fails.
>
>Is this a bug/limitation or did I miss the correct way to do this?
>
>I can work around this in bash using:
>   TAB=`echo -e "\t"`
>   sort -t"$TAB" ...
>
>but this trick doesn't work with tcsh using:
>   setenv TAB `/bin/echo -e "\t"`
>
>Must be the different way expressions are expanded with quotes in the
>two shells.
>
>Jim
>
>
>$ cat /tmp/x
>2  x, a1
>2  x, b
>1  x, a2
>
>NB: Each line consists of x,
>
>***
>
>RH 7.2, textutils-2.0.14-2
>
>$ sort -t'\t' -u -k2,2 -k1,1 /tmp/x
>sort: multi-character tab `\t'
>
>***
>
>Compaq Tru64 UNIX V5.1 (Rev. 732)
>
>% sort -t'\t' -u -k2,2 -k1,1 /tmp/x
>2   x, a1
>1   x, a2
>2   x, b
>
>***
>
>___
>Bug-textutils mailing list
>[EMAIL PROTECTED]
>http://mail.gnu.org/mailman/listinfo/bug-textutils


___
Bug-textutils mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-textutils



tab as sort's field-separator

2002-06-15 Thread Jim Fohlin

Hi,

It appears that one can't specify just a tab (a tab and only a tab) as
sort's field-separator.  As shown below, the UNIX example does it
right whereas the Linux example fails.

Is this a bug/limitation or did I miss the correct way to do this?

I can work around this in bash using:
TAB=`echo -e "\t"`
sort -t"$TAB" ...

but this trick doesn't work with tcsh using:
setenv TAB `/bin/echo -e "\t"`

Must be the different way expressions are expanded with quotes in the
two shells.

Jim


$ cat /tmp/x
2   x, a1
2   x, b
1   x, a2

NB: Each line consists of x,

***

RH 7.2, textutils-2.0.14-2

$ sort -t'\t' -u -k2,2 -k1,1 /tmp/x
sort: multi-character tab `\t'

***

Compaq Tru64 UNIX V5.1 (Rev. 732)

% sort -t'\t' -u -k2,2 -k1,1 /tmp/x
2   x, a1
1   x, a2
2   x, b

***

___
Bug-textutils mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-textutils