![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to pass option with "at" command? | bd9439 | UNIX for Dummies Questions & Answers | 3 | 03-24-2008 12:45 PM |
| Running command "md5" on remote host not working. | ynilesh | UNIX for Advanced & Expert Users | 1 | 02-01-2008 04:15 AM |
| Listing only directories in the current working directory using the "ls" command | igandu | UNIX for Dummies Questions & Answers | 2 | 05-12-2006 01:47 AM |
| Unix "at" / "Cron" Command New Problem...Need help | Mohanraj | UNIX for Dummies Questions & Answers | 3 | 01-26-2006 04:08 PM |
| Does "gzip" have a no prompt option on it for overwriting if file exists? | LordJezo | UNIX for Dummies Questions & Answers | 1 | 07-29-2004 06:39 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
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 |
| Forum Sponsor | ||
|
|