For example, the only thing in file.txt looks like this:
xxxxxxxxxHAHAxxxxxxHOHOxxxxxxx
I hope to replace HAHA with seq 1 3 and replace HOHO with seq 5 7, so the output should be:
xxxxxxxxx1xxxxxx5xxxxxxx
xxxxxxxxx2xxxxxx6xxxxxxx
xxxxxxxxx3xxxxxx7xxxxxxx
What I did:
for i in $(seq 1 3)
do sed "s/HAHA/$i/g" file.txt
for i in $(seq 5 7)
do sed "s/HOHO/$i/g" file.txt
done
done > new.txt
But new.txt doesn't show what I expected. How should I change the code?