How to read sequentially from a file in SH (not KSH)
Augustine Cano
afc at shibaya.lonestar.org
Sat Apr 27 11:23:36 AEST 1991
KSH can handle reading from a file sequentially with no problem if
one uses the following statements:
exec 3< $FILENAME
while read -u3 VAR1 VAR2; do
print $VAR1 $VAR2
done
SH does not support this (at least not the one I have). I have tried:
while read VAR1 VAR2 < $FILENAME; do
echo $VAR1 $VAR2
done
but I keep reading the first line in the file over and over. Nothing in
the manual page seems to be usable in this situation. How is this done
under SH? Is it possible? Using ksh is not an option since the machine
I need to run this on does not have it.
Thanks in advance. I'll summarize e-mailed responses.
--
Augustine Cano INTERNET: afc at shibaya.lonestar.org
UUCP: ...!{ernest,egsner}!shibaya!afc
More information about the Comp.unix.shell
mailing list