[comp.unix.shell] SUMMARY & THANKS Re: How to read sequentially from a file in SH

afc@shibaya.lonestar.org (Augustine Cano) (05/14/91)

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@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@shibaya.lonestar.org
			UUCP:     ...!{ernest,egsner}!shibaya!afc