search and replace combination of two words...with a constraint

Hi I have 100 files in my directory.
Please help me how to do in Unix or any other scriptin lanuages.
I want to replace all occurances of "goutham" to goutham_ind ONLY if the file contains the word "goutham" with the word "engineer";
for eg----test1 is a file contains the following inf;
goutham engineer
test2 is a file contains the following inf;
goutham softwareengineer
Here i want to replace "goutham" to "goutham_ind" when it contains only engineer.Not softwareengineer;

the final result should be;
Test1;
goutham_ind engineer;
pls pls pls help me...

Assuming your file has only 2 columns as posted:

awk '$1=="goutham" && $2=="engineer" {$1=$1 "_ind" }1' file

grep -w option will help you search the files with word engineer

grep -l -s -w engineer *

This will list the files .

Then in a loop you can procees the files to edit using sed

sed 's/goutham/gautham_india/g'

using PERL:-

perl -wlpe '/\bgoutham\b/ and /\bengineer\b/ and s/engineer/$&_ind/gi;' infiles.txt

hi thanks for your reply,but my requirement is if goutham and only engineer word satisfy then only it replace goutham to goutham_ind.and they are not columns..there are 100 files in a directory and in some files contains goutham and engineer and goutham and softwareengineer.I want to update goutham to goutham_ind if engineer word alone occurs with goutham.

if the files have the same suffix like txt use below were the -i option will modify the files itself:-

perl -i -wlpe '/\bgoutham\b/ and /\bengineer\b/ and s/goutham/$&_ind/gi;' *.txt

:D:D:D

hi Ahmed.....thanks alot..you r realy star....got it...thanks alot again