Questions:
1) Using sed, how would you do a pattern replacement if the pattern contains slashes?
Example:
Input Pattern is /w585/odbi/BCPWK/DOCGET/
Output Pattern is blank
sed -i 's//w585/odbi/BCPWK/DOCGET///' filename
When I use the above command I get the following error:
sed: -e expression #1, char 9: unknown option to `s'
2) Can you do a in place edit using awk?
Thank you
Try "escaping" the slashes in the pattern using a preceding backslash, e.g.,
sed -i 's/\/w585\/odbi\/BCPWK\/DOCGET\///' filename
I don't have my SED references here, so I'm not sure if you can use alternate pattern delimiters in SED. You certainly can in Perl, which makes patterns like that much easier to read. I also have not used awk for a number of years so I am not sure about in place editing with awk. I think you may be able to do that.
Although I don't want to play the language bigot and say that Perl is the answer to everything, again, you can do it easily in Perl. Google for "perl edit in place" and you will find useful information.
HTH,
Paul