I am new in linux and I try reading a text file line by line. The lines are numbers. I want to add each line in an array and consider each number as a variable. My trial is as below:
Example of txt file:
1976 1 0 0.00 0. 68. 37. 0. 105. 0.14 0.02 4.3 1.1 2.2
What I need:
Putting each number in a variable. for example a = 1976 and b = 1 etc...
My code:
IFS=$'\n'
for next in `cat $filename`
do
line=$next
echo ${line[0]}
done
Result:
1976 1 0 0.00 0. 68. 37. 0. 105. 0.14 0.02 4.3 1.1 2.2
awkfor this.