I need to replace the text from File2.txt to File1.txt between 5th and 8th position. It supposed to be any character between 5th and 8th position, I just need to replace with new characters in mentioned position and remaining position character should be same as it is.
File1.txt:
abcd9876efghijklmno
abcd9676efghijklmno
abcd9886efghijklmno
abcd9976efghijklmno
File2.txt:
1234
4321
6543
5678
Expected output:
abcd1234efghijklmno
abcd4321efghijklmno
abcd6543efghijklmno
abcd5678efghijklmno
Command I tried
sed '/substr($0,5,4)/r File2.txt' File1.txt >file_new.txt