How to read sequentially from a file in SH (not KSH)

Michael Stefanik mike at bria.UUCP
Sun Apr 28 19:36:35 AEST 1991


In an article, afc at shibaya.lonestar.org (Augustine Cano) writes:
|
|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? 

cat $FILENAME | while read VAR1 VAR2
do echo $VAR1 $VAR2
done

-- 
Michael Stefanik, MGI Inc, Los Angeles | Opinions stated are never realistic
Title of the week: Systems Engineer    | UUCP: ...!uunet!bria!mike
-------------------------------------------------------------------------------
If MS-DOS didn't exist, who would UNIX programmers have to make fun of?



More information about the Comp.unix.shell mailing list