1755109 Members
4443 Online
108830 Solutions
New Discussion юеВ

need refresh in regexp

 
SOLVED
Go to solution
Holger Knoppik
Valued Contributor

need refresh in regexp

Hello Gurus,

I need a refresh in regular expression stuff. I want to replace the pattern "/usr/local" with "/opt/openssh2" in an INFO file for installing the package into the desired path.

I know that I have to quote the slash, but don't know how to ...

Any help appreciated.
RGDS, Holger
Live long and prosper!
4 REPLIES 4
S.K. Chan
Honored Contributor
Solution

Re: need refresh in regexp

This could work too..
# sed 's/\/usr\/local/\/opt\/openssh2/g' INFO > INFO.new
Andreas Voss
Honored Contributor

Re: need refresh in regexp

Hi,

with sed ie:

sed -e 's@/usr/local@/opt/openssh2@g' .....

Regards
John Palmer
Honored Contributor

Re: need refresh in regexp

Hi,

You could use ex to do this to the file in situ, just use ; instead of / as a string delimeter, something like...

ex
%s;/usr/local;/opt/openssh2;g
wq

This will work in vi as well.

Regards,
John
harry d brown jr
Honored Contributor

Re: need refresh in regexp

http://sitescooper.org/tao_regexps.html

echo "/usr/local" | sed "s_/usr/local_/opt/openssh2_"

live free or die
harry
Live Free or Die