Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!uunet!ibmps2!aix!nwosuck From: nwosuck@aix.aix.kingston.ibm.com (Kingsley Nwosu) Newsgroups: comp.unix.questions Subject: Re: How read a line of a file from C-shell? Message-ID: <4339@aix.aix.kingston.ibm.com> Date: 30 Oct 90 18:30:32 GMT References: <8900@ncar.ucar.edu> Organization: IBM Corporation, Kingston, NY Lines: 24 In article <8900@ncar.ucar.edu>, tparker@bierstadt.scd.ucar.edu (Tom Parker) writes: > > > I tried something like foreach line(`cat file`) > > 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? > On my IBM AIX/370 OS I am able to do: cat | awk '{FS=CR; print $1}' This prints each line. You can then pipe the output to the desired function, if that is what you want. Kingsley Nwosu ...uunet!ibmps2!aix!nwosuck IBM AIX Dev., Dept. 83HA/572, | Neighborhood Rd, Kingston, |"Advice to those about to get married: Don't!" NY 12401. |