Hi all,
I would like to replace some string in a text file by some string which would contains special characters like "/","\".
I.e. I have a text file with the statement contactperson somewhere in it.
Now I want to replace it by something else which includes special
characters like "/","\"
For this I'm using awk command like shown below:
cat hh | awk -v con="/BGL04/" '{gsub(/contactperson/,con)}1' > final
The above command will replaces contactperson with /BGL04/.This is ok.
But above command is failing for "\" character:
cat hh | awk -v con="BGL\04" '{gsub(/contactperson/,con)}1' > final
Above command is replacing contactperson with BGL only.It's truncating the characters which comes after "\" characters.
What I'm looking is after replacement I should get the same string that i uses for replacement
Is there any way to do it, maybe with awk,sed?
Please let me know.
Awaiting for kind responses.
Thanks in Advance.
Regards,
Shareef