Reading a file from withing a C-shell script
Patrick Hertel
afsipmh at cid.aes.doe.CA
Fri Nov 16 01:27:50 AEST 1990
In article <2945 at uc.msc.umn.edu> wes at msc.edu writes:
>Suppose one has a file containing names of other files like this:
>
>data.0001.rle
>data.0020.rle
>data.0025.rle
>data.0085.rle
>
>From a C-shell script, I would like to, one-by-one, get the names out
>of this data file and do something with them like this:
>
>#!/bin/csh -f
>#
>#
>foreach file (my_file_list)
> echo $file
> process $file
>end
>
>Does anyone know how I do that?
where $1 is the name of your list file
in the scipt call:
#!/bin/csh -f
#
#
foreach file (`cat $1`)
echo $file
process $file
end
--
Pat Hertel Canadian Meteorological Centre
Analyst/Programmer 2121 N. Service Rd. % rm God
phertel at cmc.aes.doe.ca Dorval,Quebec rm: God non-existent
Environment Canada CANADA H9P1J3
More information about the Comp.unix.shell
mailing list