Replace word in a file

Guys,
I need to replace a portion of the lines in the file depending on the word

in my file i have this content
use DBNAME
go
print "use DBNAME"

i want to replace the variable DBNAME with something else. But the catch is this line is not always "use DBNAME". Sometimes it can be like "use NAME"
Hence i need to find the word use and then replace the word after that.

I am absolutely clueless about this and I would appreciate your help in this

Thanks
Sasi

sed '/use/s/DBNAME/perfect/g' a

search for 'use'

and then replace DBANME with perfect

Is the current thread duplicate of

?

Yes. Closed.