I know how to insert a single text to specific interval. But now my problem is, I want to insert different texts/words saved in an add.txt file to a specific intervals of another data.txt file.
I want to insert first word from add.txt to a specific position of data.txt, then add second word from add.txt to next specific position and so on.
My data.txt contain two columns, but the inserted word must appear as a merged row. Please see the example below of what I need.
add.txt
2001-01-01 00:00:00 42 1
2001-01-02 00:00:00 42 1
2001-01-03 00:00:00 42 1
2001-01-04 00:00:00 42 1
2001-01-05 00:00:00 42 1
data.txt
-500 11.822788
-400 12.006394
-350 12.287062
-300 12.793395
-500 11.823597
-400 12.008012
-350 12.287062
-300 12.794204
-500 11.826023
-400 12.011247
-350 12.291915
-300 12.800675
-500 11.827641
-400 12.013674
-350 12.295959
-300 12.805528
-500 11.830067
-400 12.016100
-350 12.300003
-300 12.811998
I want
2001-01-01 00:00:00 42 1
-500 11.822788
-400 12.006394
-350 12.287062
-300 12.793395
2001-01-02 00:00:00 42 1
-500 11.823597
-400 12.008012
-350 12.287062
-300 12.794204
2001-01-03 00:00:00 42 1
-500 11.826023
-400 12.011247
-350 12.291915
-300 12.800675
2001-01-04 00:00:00 42 1
-500 11.827641
-400 12.013674
-350 12.295959
-300 12.805528
2001-01-04 00:00:00 42 1
-500 11.830067
-400 12.016100
-350 12.300003
-300 12.811998
I am looking for a simplest solution using awk, sed or something.