Hi!
I've just started writing a script to read multiple files and save the data in different variables. More precisely, I have two different files containing one column of data each (both files equally many rows):
Code:
file1: file2:
0 3
1 5
2 20
3 3
. .
. .
I want to read line by line in a for or while loop and save the corresponding row value in two different variables (that I will later use as input into another function). It would work something like, in "semi-code" =):
Code:
for i=1 to "number of rows in files"
variable1 = i:throw in file1
variable2 = i:th row in file2
function(variable1, variable2)
end
I've managed to do what I want when just reading one file:
Code:
#!/bin/bash
cat file1.dat | while read line
do
variable1="$line"
function($variable1)
done
Any ideas how to transform this to reading multiple files at the same time? Thanks!
Ida