find a pattern and replace

i have a file which contains lines like this.

intsrcrpttrn1099mctrl:export GRAPHPARM_AR[1]="-input_code M302023"
intsrcrpttrn1099mload:export GRAPHPARM_AR[1]="-input_code M192023"
intsrcrpttrn1099mload:export GRAPHPARM_AR[1]="-input_code P192023"

the value after -input_code starts with some alphabet followed by numeric.i want to check if the alphabet is M then it will be replaced by m.else it will be as it is.

so output will be

intsrcrpttrn1099mctrl:export GRAPHPARM_AR[1]="-input_code m302023"
intsrcrpttrn1099mload:export GRAPHPARM_AR[1]="-input_code m192023"
intsrcrpttrn1099mload:export GRAPHPARM_AR[1]="-input_code P192023"

Hi,

Use code tag.
Try this,

perl -lne '$_=~s/(.+?)=(\".+?\s)M(\d+)/$1=$2m$3/g; {print $_}' inputfile

Here is the code -

awk -F ' ' '$3 ~ /^M.+/ { gsub( "M", "m", $3); print; }'  <file name>

untested

sed 's/-input_code M/-input_code m/' file

thanks a ton...