I have a cat.dat file, i would like shell to read each 3 lines and set this 3 lines to 3 different variables.
my cat.dat is:
11
12
+380486461001
12
13
+380486461002
13
14
+380486461003
i want shell to make a loop and assign 1st line to student_id, 2nd line to studentaccount and 3th line to studentinfo, and continuining on this way for each 3 lines respectively.
I wrote this code, but i am not able to assign this 3 variables
#!/bin/bash
a=0
while read line
do a=$(($a+1));
echo q=$line;
done < "cad.dat"
echo "Final line count is: $a";
I really appreciate any help, thank you in advance :).