String replacement.

Dear Friends,
I want to replace following line with given line.

It should grep/search following string in a file (input.txt)
M/M SRNO: 000M/6200-0362498 COSMETIC PRO MALE FEMALE

Once found it should replace it to following string.
T_DLHNNO: 000M/6200-0362498 COSMETIC PRO MALE FEMALE

Kindly guide.
Thanks in advance
Anu.

it is simple .. pls post your try ..

sed 's|M/M SRNO: 000M/6200-0362498 COSMETIC PRO MALE FEMALE|T_DLHNNO: 000M/6200-0362498 COSMETIC PRO MALE FEMALE|g' < input.txt > outFile
$ nawk '/M\/M SRNO/ {sub(/M\/M SRNO/, "T_DLHNNO")};1' infile

Thanks Max_hammer and Jayan_jay,
I have tried both the solutions and Max_hammer's solution worked partially (we can not use sed in our case for some reason). Jayan_jay's solution has nawk which our system says -bash: nawk: command not found.

We would be grateful to you if you provide some other solutions.
Anu.

then try with awk instead of nawk

Hey Jayan_jay,

awk worked but not exactly how we want. It has straight away replaced all M/M SRNO by T_DLHNNO without matching remaining part i.e. (000M/6200-0362498 COSMETIC PRO MALE FEMALE) of sting.

Please guide.
Anu.

Assuming the later part is a fixed value, you can just add it to the search pattern:

awk '/M\/M SRNO: 000M\/6200-0362498 COSMETIC PRO MALE FEMALE/ {sub(/M\/M SRNO/, "T_DLHNNO")};1' infile