Variables in csh

Quang Ngo quang at CSUFRES.CSUFRESNO.EDU
Thu May 2 17:02:53 AEST 1991


1)

In csh, we can have something like

set a = (This is a string)
echo $a[2]

which prints 'is'   

Now, let's say I have

set a = "This is a string"
               
How do I print 'str' ?


2)

Let's say I have a file 'data' which contains the following 3 lines.

John 234
Bill 123
Tom 231

and a csh script 'test'

#!/bin/csh -f
foreach a (`cat data`)
	echo $a
end

This prints

John
234
Bill
123
Tom
231

Looks like the FS (file separator) is space and/or newline, and ???
I want the FS just to be newline so that 'test' would print

John 234
Bill 123
Tom 231

The question is how?  I know how to take care these problems in (n/g)awk.

Thanks,

-Quang (quang at csufres.CSUFresno.EDU)



More information about the Comp.unix.questions mailing list