Variables in csh
Steven M. List
itkin at mrspoc.Transact.COM
Fri May 3 09:44:35 AEST 1991
quang at CSUFRES.CSUFRESNO.EDU (Quang Ngo) writes:
>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' ?
expr "$a" : '.\{10\}\(...\).*'
or
echo "$a" | cut -c11-13
or...
>2) Let's say I have a file 'data' which contains the following 3 lines.
>...
>The question is how? I know how to take care these problems in (n/g)awk.
I don't have an answer to the second one in C shell syntax. In Bourne
(/bin/sh) it's easy:
while read $LINE
do
echo $LINE
done < datafile
and variations on that theme. But csh doesn't have anything quite like
"read".
--
+----------------------------------------------------------------------------+
: Steven List @ Transact Software, Inc. :^>~ :
: Chairman, Unify User Group of Northern California :
: itkin at Transact.COM :
More information about the Comp.unix.questions
mailing list