I have three files: f1, f2, and f3. If each file has a number of lines such that
f1
The sky is blue
The earth is round
This is paper
f2
aaaaaaaaaa
bbbbbbbbbbbbb
cccccccccc
f3
kkkkkkkkkkkkkkkkkkk
lllllllllllllllllllllllllll
ooooooooooooooo
Now I want to write a program that goes to file one, grabs the first line, then goes too file 2, grabs the first line, and finally goes to file 3 and grabs the first line.
It then returns to file1, grabs the second line, then goes to f2, grabs the 2nd line, and goes to f3, grabs the 2nd line.
Finally, it foes to file 1, grabs the 3rd line and so on until it all three files are read and one single file is created.
I tried the following script and it is not doing what I want. That's where I would need some help.
for i in line
do
while read line
do
echo $line >> lline
done<f1
while read line
do
echo $line >> lline
done<f2
while read line
do
echo $line >> lline
done<f3
done
The desired output is:
The sky is blue
aaaaaaaaaa
kkkkkkkkkkkkkkkkkkk
The earth is round
bbbbbbbbbbbbb
lllllllllllllllllllllllllll
this is paper
cccccccccc
ooooooooooooooo
How can I fix my code?