I have a file (say file1.txt) and I have to search for a line which has a text replace it and replace another string too in the same line.
Eg:
file1.txt
--------
This code will only work when the 'x=hai' part is before 'y=universe'. When it is not the case, you may find the following code useful (here, as a script file)
#!/bin/sed -f
/x='hai'/ {
s/y='world'/y='universe'/
t a
b
:a
s/x='hai'/x='hello'/
}