Find and replace using sed command

The content of the file filea.txt is as follows.
---------

case $HOSTNAME in
        aaa)
                DS_PARM_VALUE_SET=vsDev
                APT_Configuration_File=/appl/infoserver/Server/Configurations/2node.apt

                ;;
        bbb)
                DS_PARM_VALUE_SET=vsQA
                APT_Configuration_File=/appl/infoserver/Server/Configurations/2node.apt

                ;;
        ccc)
                DS_PARM_VALUE_SET=vsProd
                APT_Configuration_File=/appl/infoserver/Server/Configurations/2node.apt

                ;;
        *)
                DS_PARM_VALUE_SET=vsDev
                APT_Configurations_File=/appl/infoserver/Server/Configuarations/2node.apt

                ;;
esac

---------

Now aaa has to be changed to 'DEV', bbb has to be changed to 'QA' and ccc has to be changed to 'PROD'.

The new file should be as follows.
---------

case $HOSTNAME in
        'DEV')
                DS_PARM_VALUE_SET=vsDev
                APT_Configuration_File=/appl/infoserver/Server/Configurations/2node.apt

                ;;
        'QA')
                DS_PARM_VALUE_SET=vsQA
                APT_Configuration_File=/appl/infoserver/Server/Configurations/2node.apt

                ;;
        'PROD')
                DS_PARM_VALUE_SET=vsProd
                APT_Configuration_File=/appl/infoserver/Server/Configurations/2node.apt

                ;;
        *)
                DS_PARM_VALUE_SET=vsDev
                APT_Configurations_File=/appl/infoserver/Server/Configuarations/2node.apt

                ;;
esac

---------
I have tried the following command to perform this. But it did not work.

---------

find ${Appl_Path} -type f -name '*.properties' -print | while read i
do
    sed -e 's/aaa/\'DEV\'/g' $i > $i.tmp && mv $i.tmp $i
    sed -e 's/bbb/\'QA\'/g' $i > $i.tmp && mv $i.tmp $i
    sed -e 's/ccc/\'PROD\'/g' $i > $i.tmp && mv $i.tmp $i
done

---------

Can anyone help me to fix this issue?

Thanks
Krishnakanth Manivannan

Please use code tags around code fragments or data samples

Try this awk code:

awk '   /aaa/ {
                sub("aaa","'\''DEV'\''");
}       /bbb/ {
                sub("bbb","'\''QA'\''");
}       /ccc/ {
                sub("ccc","'\''PROD'\''");
}1' input_file > output_file

The gnu sed has -i for update in place. You can just say:

find ${Appl_Path} -type f -name '*.properties' | while read i
 do
  sed -i '
    s/aaa/'"'"'DEV'"'"'/g
    s/bbb/'"'"'QA'"'"'/g
    s/ccc/'"'"'PROD'"'"'/g
   ' $i
 done

Nothing is meta in ' land, so leave for " land; a single quote in a single quoted string is single-double-single-double-single; I guess I just don't like barefoot \'. Single quotes saves the shell and unwary programmer from any interpretation. Also go to " land for $variables, then come back. Flie globbing is barefoot time.

You, too, deserve nicely indented code where the sed-isms are on different lines than the shell-isms. It prevents bugs and makes maintenance more error-free.

Using sed

sed 's/aaa/'\''DEV'\''/; s/bbb/'\''QA'\''/; s/ccc/'\''PROD'\''/' input_file