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

Kingsley Nwosu nwosuck at aix.aix.kingston.ibm.com
Wed Oct 31 05:30:32 AEST 1990


In article <8900 at ncar.ucar.edu>, tparker at 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 <filename> | 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.			|	 



More information about the Comp.unix.questions mailing list