I have two files: file1.txtand file2.txt. Each of them has the same number of lines, but some of the lines file1.txtare empty. This is easiest to see when the contents of two files are displayed in parallel:
file1.txt file2.txt
cat bear
fish eagle
spider leopard
snail
catfish rainbow trout
snake
koala
rabbit fish
I need to put these files together so that empty lines in are file1.txtfilled with data found in lines (of one line number) from file2.txt. The result in file3.txtwill look like this:
cat
fish
spider
snail
catfish
snake
koala
rabbit
, , - while read -r line, , , while , if-conditional, , $line , cut, file2.txt . .
file2.txt . file1.txt , file2.txt , file3.txt.
?