Path: utzoo!attcan!uunet!timbuk!cs.umn.edu!uc!noc.MR.NET!msi.umn.edu!umeecs!umich!caen!zaphod.mps.ohio-state.edu!ncar!bierstadt.scd.ucar.edu!tparker From: tparker@bierstadt.scd.ucar.edu (Tom Parker) Newsgroups: comp.unix.questions Subject: How read a line of a file from C-shell? Message-ID: <8900@ncar.ucar.edu> Date: 19 Oct 90 23:26:11 GMT Sender: news@ncar.ucar.edu Reply-To: tparker@bierstadt.scd.ucar.edu (Tom Parker) Organization: Scientific Computing Division/NCAR, Boulder, CO Lines: 16 I'm having trouble finding a way to read a line of a file in the C-shell. For instance, I would like my script to read the first line of a file, process it, then read the second line, process it, etc. I tried something like foreach line(`cat file`) but this seems to process the entire file, a word at a time. The only method I've gotten to work is this inelegant structure: set line = `head -$n | tail -1` # Read n-th line Does anyone have better ways to do file I/O in a C-shell script? Thanks, Tom