Say I have two files.
File1 contains:
line1 line2 line3 line4 line5 line6 line7 line8 line9 line10
and File2 contains:
anotherline1 anotherline2 anotherline3
I want to make the while loop so that it displays this in File3:
line1 line2 anotherline1 line3 line4 anotherline2 line5 line6 anotherline3 line7 line8 anotherline1 line9 line10 anotherline2
I was looking for an answer here, but I canโt figure out how to do this. I have to say that I'm pretty noob in shell scripts ...
Also: "while loop" should be to the end of file1. No matter how long File2, in fact, in my personal scenario, File2 will always be shorter than File1. The output should be: File1Line1, File1Line2, File2Line1, File1Line3, File1Line4, File2Line2 .... etc.
Any help?
note: if this has been said before, then mods, please close this question. I simply could not find the answers after searching the Internet for several hours.
EDIT: Added clarification on when to complete the loop.
source share