to replace one character by numbers in a file

suppose u have a file

aas P-H 123
gdg O-U 223
hdy I-Y 12
fgd K-O 333
ssa L-P 32

output shud be like that
aas P123H
gdg O223U
hdy I12Y
fgd K333O
ssa L32P

thanks

sed -n -e "s/\(.*\)-\([^ ]* \)\(.*\)/\1\3\2/p" input.txt

But if u have 0-9 digits then
\1\2\3 can we place [0-9]????

 # awk '{sub("-",$3,$2);$3=""}1' "file"
aas P123H
gdg O223U
hdy I12Y
fgd K333O
ssa L32P

sorry not working......
Regards

so are we expected to guess what's wrong? show your error messages..

\1, \2, \3 so on and so forth are placeholders for the sub-regex expressions matched within each \( \) construct of a "s/regex/replacement/g" sed statement.

The sed statement should be

sed -n -e "s/\(.*\)-\([^ ]* \)\(.*\)/\1\3\2/p" input.txt

hi,

awk '{print $1" "substr($2,1,1)$3substr($2,3,1)}' filename