Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!think.com!snorkelwacker.mit.edu!apple!mrspoc!itkin From: itkin@mrspoc.Transact.COM (Steven M. List) Newsgroups: comp.unix.questions Subject: Re: Variables in csh Message-ID: <1991May2.234435.6083@mrspoc.Transact.COM> Date: 2 May 91 23:44:35 GMT References: <9105020702.AA06707@csufres.CSUFresno.EDU> Reply-To: steven@Transact.COM Organization: Transact Software Lines: 43 quang@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@Transact.COM :