how to find the pattern inside the file and replace it

hello everybody,
I have a group of file
eg-

    sample1
    sample2 
    sample3
    sample4

each file contain this :-

cat sample1
SEQ_NUM,1,UPESI1

My requirement is to
change the value-UPESI1 to UPE10 in file which contain this pattern -UPESI1.

any help is appreciated.

Do a test like this to see if the output is what you expect and no unexpected changes are made:

sed 's/,UPESI1/,UPE10/' sample1 | less

When you are sure it's right (e.g. did you want a leading dash or not), change one file like this (-i is for change it in place):

sed -i 's/,UPESI1/,UPE10/' sample1

Or do them all

sed -i 's/,UPESI1/,UPE10/' sample*

find . -name sample* | xargs perl -pi -e 's/UPESI1/UPE10/g'