Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!samsung!olivea!uunet!virtech!cpcahil From: cpcahil@virtech.uucp (Conor P. Cahill) Newsgroups: comp.unix.shell Subject: Re: How to read sequentially from a file in SH (not KSH) Message-ID: <1991Apr28.023919.27584@virtech.uucp> Date: 28 Apr 91 02:39:19 GMT References: <1991Apr27.012336.2732@shibaya.lonestar.org> Organization: Virtual Technologies Inc. Lines: 27 afc@shibaya.lonestar.org (Augustine Cano) writes: >while read VAR1 VAR2 < $FILENAME; do > echo $VAR1 $VAR2 >done use: while read VAR1 VAR2; do echo $VAR1 $VAR2 done < $FILENAME or: cat $FILENAME | while read VAR1 VAR2; do echo $VAR1 $VAR2 done >but I keep reading the first line in the file over and over. Nothing in This is because the shell kept reopening the file every time it went to execute the read. -- Conor P. Cahill (703)430-9247 Virtual Technologies, Inc. uunet!virtech!cpcahil 46030 Manekin Plaza, Suite 160 Sterling, VA 22170