My file working.txt
has 1000's of lines, which repeat in a simple pattern as follows:
name
date_ax
name
date_cd
name
date_ed
name
date_dc
...etc
I need to replace each instance of name
with the sequential next line from another file called other.txt
, such that each line of other.txt
is looped through for each replacement of name
.
other.txt
file content looks like this:
namedewqdwq
name32321321
name3434243gf
nameewqewqeeq
After the replacement my working text file working.txt
would look like this:
namedewqdwq
date_ax
name32321321
date_cd
name3434243gf
date_ed
nameewqewqeeq
date_dc
...etc
How can this be done?