1755385 Members
4089 Online
108832 Solutions
New Discussion юеВ

regular expression

 
SOLVED
Go to solution
Erol KAHRAMAN
Advisor

regular expression

hi guys,
may be this is very simple question but i can't found the answer.
I need to match
** (two star)
with regular expression.
i tried
sed s/\*\*/something/ file
sed s/*{2}/something/ file
sed s/\*+/something/ file
...

any suggestion
4 REPLIES 4
James R. Ferguson
Acclaimed Contributor
Solution

Re: regular expression

Hi Erol:

# sed -e 's/\*\*/something/' file

Regards!

...JRF...
OldSchool
Honored Contributor

Re: regular expression

sed 's/\*\*/new/' file
A. Clay Stephenson
Acclaimed Contributor

Re: regular expression

Quotes matter:

sed 's/\*\*/something/g' file > outfile
will replace every occurence of "**" with "something".
If it ain't broke, I can fix that.
Erol KAHRAMAN
Advisor

Re: regular expression

thanks guys,
that is the answer.