cut certain characters for each line in a file

Hi Everyone,
i have a file 1.txt

<a><a"" dd>aaaaauweopriuew</f><">!(^)!</aa></ff>
<a><a"" dd>bbbbbuweopriuew</f><">!(^*)!</aa></ff>

i know i can use

perl -p -i -e "s/>aaaaa/aa/g" 1.txt
perl -p -i -e "s/>bbbbb/bb/g" 1.txt

to acheive only keep the first two characters of the five characters, so the output is

<a><a"" dd>aauweopriuew</f><">!(^)!</aa></ff>
<a><a"" dd>bbuweopriuew</f><">!(^*)!</aa></ff>

but image this 1.txt has many lines, i cannot do this perl -p -i -e one line each.
any awk, sed, or other shell can do? :wall:

Please advice.

Thanks
Regards,

$ sed 's,aaaaa,aa,g' infile > outfile

Thanks jayan_jay, but your way is same as i use perl -i -e.
image each line is not just aaaaa to aa, but you have asdff to as, 89099 to 89... it means only keep the 1st two characters.

awk -F'[<>]' '{x=$5;sub(/??.../,y,x);sub($5,x)}1' file

Thanks Dan,

but the output is

<a><a"" dd>weopriuew</f><">!(^)!</aa></ff>
<a><a"" dd>weopriuew</f><">!(^*)!</aa></ff>

the correct output is

<a><a"" dd>aaopriuew</f><">!(^)!</aa></ff>
<a><a"" dd>bbopriuew</f><">!(^*)!</aa></ff>

Please help :frowning:

Thanks

---------- Post updated at 11:41 AM ---------- Previous update was at 09:15 AM ----------

got the answer aly.

sed 's/\(.\{13\}\).\{4\}/\1/'