How read a line of a file from C-shell?

Fred Sena sena at infinet.UUCP
Wed Nov 14 03:30:47 AEST 1990


In article <1990Oct31.232525.7990 at diku.dk> kimcm at diku.dk (Kim Christian Madsen) writes:


I haven't been on the net for a while, so I'm sorry if this response seems
untimely.

The cleanest way that I have found to get a line of a file is:


set line=`sed -n $n'p' $file`

Where $n is the line number, and $file is the file.


There can be a problem if the line contains *'s though.  Not because of sed,
but because of the way that the csh sets the line variable.  You can't store
a '*' in a csh variable because it wants to turn it into file names.
(Correction, I have yet to find a way)

good luck.
	--fred

--------------------------------------------------
Frederick J. Sena                sena at infinet.UUCP
Memotec Datacom, Inc.  N. Andover, MA
-- 
--------------------------------------------------
Frederick J. Sena                sena at infinet.UUCP
Memotec Datacom, Inc.  N. Andover, MA



More information about the Comp.unix.questions mailing list