Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

sort with a tab as separator

0 views
Skip to first unread message

phd...@gsbacd.uchicago.edu

unread,
Aug 16, 1990, 9:21:42 PM8/16/90
to
How do I indicate to sort that my field-separation character is the tab (^I)?
I know that there is a tab option (-t) in sort, but I don't know how to specify
^I ( or \t, for that matter).. No, the default is not this tab, but any
whitespace character according to my documentation.

Thanks for any help.

/ivo welch i...@next.agsm.ucla.edu

phd...@gsbacd.uchicago.edu

unread,
Aug 17, 1990, 1:52:07 PM8/17/90
to

I just figured out that it is my shell that actually translates tabs into
spaces. So, now I need a way to quote a tab (no, quotation marks or
backslash quoting don't work)...

/ivo welch i...@next.agsm.ucla.edu

Doug Gwyn

unread,
Aug 18, 1990, 10:22:15 PM8/18/90
to
In article <1990Aug17....@midway.uchicago.edu> phd...@gsbacd.uchicago.edu writes:
>I just figured out that it is my shell that actually translates tabs into
>spaces. So, now I need a way to quote a tab (no, quotation marks or
>backslash quoting don't work)...

So get a real shell:
$ echo ' ' | od -c
0000000 \t \n
0000002
$

phd...@gsbacd.uchicago.edu

unread,
Aug 19, 1990, 12:09:28 AM8/19/90
to
In article <13...@smoke.BRL.MIL>, gw...@smoke.BRL.MIL (Doug Gwyn) writes...

+So get a real shell:
+ $ echo ' ' | od -c
+ 0000000 \t \n

On a NeXT improved csh (and presumably on some other shells), the following
works:

sort -t\^V^I

that is, the tab must be quoted twice: once with the backslash, and then with
the ^V (control-V) to not substitute spaces.

Once you know this, it is no big deal, of course.

/ivo welch i...@next.agsm.ucla.edu

Guy Harris

unread,
Aug 20, 1990, 5:26:21 PM8/20/90
to
>On a NeXT improved csh (and presumably on some other shells), the following
>works:

...

>that is, the tab must be quoted twice: once with the backslash, and then with
>the ^V (control-V) to not substitute spaces.

"improved"? Thanks, NeXT; thanks a lot. The vanilla C shell doesn't
have this particular stupidity. Is this a "tcsh"ism? If so, whoever
maintains "tcsh" should seriously think about getting rid of it, 'cause
it's a crock. "csh" is broken enough already without breaking it
further....

phd...@gsbacd.uchicago.edu

unread,
Aug 20, 1990, 11:24:19 PM8/20/90
to
In article <39...@auspex.auspex.com>, g...@auspex.auspex.com (Guy Harris) writes...

+"improved"? Thanks, NeXT; thanks a lot. The vanilla C shell doesn't
+have this particular stupidity. Is this a "tcsh"ism? If so, whoever
+maintains "tcsh" should seriously think about getting rid of it, 'cause
+it's a crock. "csh" is broken enough already without breaking it
+further....

Improved: it is command-line and history editing via Emacs commands that
probably screws up some of this. I am VERY GLAD that the NeXT csh has this
feature. It makes life much more pleasant. In fact, I wouldn't even consider a
shell without this feature.

/ivo welch i...@next.agsm.ucla.edu

Richard Tobin

unread,
Aug 21, 1990, 12:18:18 PM8/21/90
to
In article <1990Aug21....@midway.uchicago.edu> phd...@gsbacd.uchicago.edu writes:
>Improved: it is command-line and history editing via Emacs commands that
>probably screws up some of this. I am VERY GLAD that the NeXT csh has this
>feature. It makes life much more pleasant. In fact, I wouldn't even consider a
>shell without this feature.

There is absolutely no reason why the fact that a shell has editing
facilities should cause it to substitute spaces for tabs. If the NeXT
csh does this then it's just plain wrong.

-- Richard
--
Richard Tobin, JANET: R.T...@uk.ac.ed
AI Applications Institute, ARPA: R.Tobin%uk.a...@nsfnet-relay.ac.uk
Edinburgh University. UUCP: ...!ukc!ed.ac.uk!R.Tobin

Guy Harris

unread,
Aug 21, 1990, 3:11:57 PM8/21/90
to
>Improved: it is command-line and history editing via Emacs commands that
>probably screws up some of this. I am VERY GLAD that the NeXT csh has this
>feature. It makes life much more pleasant. In fact, I wouldn't even consider a
>shell without this feature.

And *I* wouldn't consider a shell that turned tabs into spaces, even
though I like that kind of command-line and history editing. "ksh" has
command-line and history editing via EMACS commands, and as I remember
it didn't have any such problems; the Bourne-again shell version here
also has command-line and history editing via EMACS commands, and *it*
doesn't have that problem.

Chris Robertson

unread,
Aug 22, 1990, 1:27:38 AM8/22/90
to
If your shell munges tabs into spaces, try "sort -t'\08'" -- I just
tried it successfully on a Pyramid in the AT&T universe. Your
mileage may vary, of course.

--
"Down in the dumps? I TOLD you you'd | Chris Robertson
need two sets..." | ch...@mcc.oz

Doug Gwyn

unread,
Aug 23, 1990, 3:38:04 PM8/23/90
to
In article <39...@auspex.auspex.com> g...@auspex.auspex.com (Guy Harris) writes:
->If your shell munges tabs into spaces, try "sort -t'\08'" -- I just
->tried it successfully on a Pyramid in the AT&T universe. Your
->mileage may vary, of course.
-What sort of shell are you using? Did Pyramid "improve" the shell by
-adding this, or are you running some shell "improved" by somebody else?

Some "improvement" that would be, changing an 8 to a 9.

Guy Harris

unread,
Aug 23, 1990, 1:58:58 PM8/23/90
to
>If your shell munges tabs into spaces, try "sort -t'\08'" -- I just
>tried it successfully on a Pyramid in the AT&T universe. Your
>mileage may vary, of course.

You bet it will! The vanilla S5 Bourne shell doesn't interpret escape
sequences such as that except in the "echo" command (and I don't think
it even interprets one such as yours; try '\011' instead, 8 not being a
valid octal digit), nor does any other Bourne shell version with which
I'm familiar. The C shells with which I'm familiar don't do so, either.

What sort of shell are you using? Did Pyramid "improve" the shell by

Bob McGowen x4312 dept208

unread,
Aug 24, 1990, 8:28:14 PM8/24/90
to
In article <1990Aug17.0...@midway.uchicago.edu> phd...@gsbacd.uchicago.edu writes:
>How do I indicate to sort that my field-separation character is the tab (^I)?
>I know that there is a tab option (-t) in sort, but I don't know how to specify
You must quote a literal tab:

-t' '
^^^^^^ literal tab here entered with the TAB key
Bob McGowan (standard disclaimer, these are my own ...)
Product Support, Wyse Technology, San Jose, CA
..!uunet!wyse!bob
b...@wyse.com

Sean Legassick

unread,
Aug 30, 1990, 1:54:26 PM8/30/90
to
In article <1990Aug19.0...@midway.uchicago.edu> phd...@gsbacd.uchicago.edu writes:
=In article <13...@smoke.BRL.MIL>, gw...@smoke.BRL.MIL (Doug Gwyn) writes...
=
=+So get a real shell:
=+ $ echo ' ' | od -c
=+ 0000000 \t \n
=
=On a NeXT improved csh (and presumably on some other shells), the following
=works:
=
= sort -t\^V^I
=
=that is, the tab must be quoted twice: once with the backslash, and then with
=the ^V (control-V) to not substitute spaces.
=

Okay, csh is seriously f*cked. However:

csh% echo ' ' | od -c
0000000 \t \n
0000002

tcsh% echo '^ ' | od -c (NB: ^V needed before TAB as TAB has special
meaning in tcsh)
0000000 \t \n
0000002

So *csh may not be a 'real shell' but this I'm afraid it does do (Sun-4,
SunOs 4.0.3).

---------------------------------------------------------------------------
Sean Legassick, cu...@uk.ac.warwick.cu "Improbability factor of one
Computing Services as...@uk.ac.warwick.cu to one. We have normality.
University of Warwick Anything you still can't
(the walking C obfuscator!) handle is your own problem."

Chris Robertson

unread,
Aug 29, 1990, 11:08:11 PM8/29/90
to
In article <39...@auspex.auspex.com> g...@auspex.auspex.com (Guy Harris) writes:
>>If your shell munges tabs into spaces, try "sort -t'\08'" -- I just
>>tried it successfully on a Pyramid in the AT&T universe. Your
>>mileage may vary, of course.
>
>You bet it will! The vanilla S5 Bourne shell doesn't interpret escape
>sequences such as that except in the "echo" command (and I don't think
>it even interprets one such as yours; try '\011' instead ...

Sorry, brain out to lunch when I wrote this. Not only did I type 8 instead
of 11, but I just checked my test file and it has a typo in it. This
definitely doesn't work. I must admit, I *was* a bit surprised when it
seemed to. So just ignore me while I crawl back into that handy hole in
the wall... :-(

0 new messages