Hello rahulsk,
Following may help you in same, here I am considering that your two.txt file may help more than 2 lines.
awk 'FNR==NR{match($0,/\=.*/);A[++i]=substr($0,RSTART+2,RLENGTH-3);sub(/\,/,"-",A);next} {if(FNR%2==0){q=FNR>i?i:FNR;{split(A[q], Y,"-");C=substr($0,1,Y[1]-1);if(Y[2]==Y[3]-1){print C OFS substr($0,Y[4]+1)} else {C=C OFS substr(B,Y[2]+1,Y[3]-Y[2]-1);;C=C OFS substr($0,Y[4]);print C;C="";}}}} {if(FNR%2!=0){q=FNR>i?i:FNR;{split(A[q], Y,"-");C=substr($0,1,Y[1]-1);if(Y[2]==Y[3]-1){print C OFS substr($0,Y[4]+1)} else {C=C OFS substr(B,Y[2]+1,Y[3]-Y[2]-1);;C=C OFS substr($0,Y[4]);print C;C="";}}}}' two.txt one.txt
Output will be as follows.
xyz 33 skfo 4r443
sf abcd sd fsdf sdfd
ab bc 33 abc dsaf
Also here I want to mention that lets say there are 2 lines(as your shown Input_file) in two.txt file then 1st line rule(to cut the strings from 5-6,7-9) will be applied to all lines in one.txt which are not divided by 2 means all odd lines of one.txt and similarly 2nd line of two.txt rule (to cut the strings from 3-6,7-8) will be applied to all line of one.txt's all even lines, also considering that your two.txt file has only 2 conditions like (5-6,7-9)always, let me know if this helps you.
EDIT: Adding a non-one liner for of solution on same.
awk 'FNR==NR{
match($0,/\=.*/);
A[++i]=substr($0,RSTART+2,RLENGTH-3);
sub(/\,/,"-",A);
next
}
{
if(FNR%2==0){
q=FNR>i?i:FNR;{ B=$0
split(A[q], Y,"-");
C=substr($0,1,Y[1]-1);
if(Y[2]==Y[3]-1){
print C OFS substr($0,Y[4]+1)
}
else {
C=C OFS substr(B,Y[2]+1,Y[3]-Y[2]-1);
C=C OFS substr(B,Y[4]+1);
print C;
C="";
}
}
}
}
{
if(FNR%2!=0){
q=FNR>i?i:FNR;{
split(A[q], Y,"-");
C=substr($0,1,Y[1]-1);
if(Y[2]==Y[3]-1){
print C OFS substr($0,Y[4]+1)
}
else {
C=C OFS substr(B,Y[2]+1,Y[3]-Y[2]-1);
C=C OFS substr($0,Y[4]+1);
print C;
C="";
}
}
}
}
' two.txt one.txt
Thanks,
R. Singh