SUMMARY & THANKS Re: How to read sequentially from a file in SH

Augustine Cano afc at shibaya.lonestar.org
Tue May 14 04:33:12 AEST 1991


Many thanks to all who responded to my question, both by e-mail and follow-ups.
There were a few posted follow-ups, so I won't re-hash those.  Some e-mail
respondents indicated that some versions of sh do in fact work as ksh does.

ie:
while read VAR1 VAR2 < $FILENAME; do
  echo $VAR1 $VAR2
done

However, what did work even with my sh was the following:

while read VAR1 VAR2; do
  echo $VAR1 $VAR2
done < $FILENAME

Also, Hans Mulder (hansm at cs.kun.nl) says that on SunOS 4.1.1 this works:

exec 3< $FILENAME

while read VAR1 VAR2; do
  echo $VAR1 $VAR2
done <&3

Thanks again to all who responded.

-- 
Augustine Cano		INTERNET: afc at shibaya.lonestar.org
			UUCP:     ...!{ernest,egsner}!shibaya!afc



More information about the Comp.unix.shell mailing list