Sort problems

Ken Turkowski ken at turtlevax.UUCP
Wed Jan 23 06:30:28 AEST 1985


In article <2041 at pegasus.UUCP> mzal at pegasus.UUCP (Mike Zaleski) writes:
>
>   From: naiman at pegasus.UUCP (Ephrayim J. Naiman)
>   Okay you sort experts why do these two sorts not work ?
>
>   ...
>
>   sort << !
>   Abe
>   $Aba
>   !
>
>Try escaping the $ with a backslash when entering this to the shell.
>By the way, the ASCII value of '$' is also less than that of 'A'.
>
>-- Mike^Z   [allegra!, ihnp4!] pegasus!mzal   Zaleski at Rutgers

Even better, put quotes around the !:

sort << '!'
Abe
$Aba
!

Which produces the output:

$Aba
Abe

To quote from the Bourne shell documentation:

<< word
	The shell is read up to a line the same as word, or end of
	file.  The resulting document becomes the standard input.  If
	any character of word is quoted, no interpretation is placed
	upon the characters of the document; otherwise parameter and
	command substitution occurs, \newline is ignores, and \ is used
	to quote the characters \ $ ' and the first character of word.

The C shell has analogous propeties.
-- 

Ken Turkowski @ CADLINC, Menlo Park, CA
UUCP: {amd,decwrl,nsc,seismo,spar}!turtlevax!ken
ARPA: turtlevax!ken at DECWRL.ARPA



More information about the Comp.unix.wizards mailing list