Thread: loop question
View Single Post

   
  #1 (permalink)  
Old 02-16-2008, 05:09 AM
Jeff Hyman
 
Posts: n/a
Default loop question

Hello fellow fellows,

I have a file named "INPUT" that contains thousands of lines. Example:
101001 2345
101002 4359
101003 25459
.... etc...

What Id like to do, is be able to set each line as a variable
in a loop.
Example:
$1 = 101001
$2 = 2345

$1 = 101002
$2 = 4359

$1 = 101003
$2 = 25459

If I can get the variables set as above, I can pass them to
an isql statement for a mass update of a database table.

# while read INPUT
# do
for i in `cat INPUT`
do
echo "i: ${i}"
echo "------- \c" ; read ans
done
# done

Obviously, the loop above echo's each column seperately, and
not as one line... and trying to get the output as a $1/$2
is not working.

Any ideas where I'm going wrong?
TIA,
Jeff H

Reply With Quote