On Mon, 11 Nov 2002, Benoit Lacherez wrote:
> The easiest is to try:
>
> % echo '(abc.com)' | sed 's/(\([^)]*\))/\1/g'
> abc.com
> % echo '(abc.com)' | sed 's/\(([\w]+)\)/\1/g'
> (abc.com)
Easier yet is
echo '(abc)' | tr -d '()'
(Which maybe is not what was wanted, but does what was asked. 8-)
John Von Essen a écrit :
> Im confused.
>
> Wouldn't s/(\([^)]*\))/\1/g just replace exactly what it finds? I think
> the outer ()'s got mixed up.
No. sed doesn't use extended regex so the special character is \( and
the literal bracket is (.
The easiest is to try:
% echo '(abc.com)' | sed 's
Im confused.
Wouldn't s/(\([^)]*\))/\1/g just replace exactly what it finds? I think
the outer ()'s got mixed up.
To take (hello) and change it to hello, you would do:
sed 's/\(([\w]+)\)/\1/g'
\w is fine if you only want the cases where text only is inside.
-John Von Essen
On Monday, Novemb
Oi Yan a écrit :
> Hi all
>
> How do I remove the backet "(" ")"
>
> file:
> (abc.com)
>
> to
>
> file:
> abc.com
>
>
> thank you for your help
>
What about sed 's/(\([^)]*\))/\1/g' ?
--
Benoit Lacherez
Académie de Bordeaux -- CATICE
Projet de traduction de la documentation de Python:
Hi all
How do I remove the backet "(" ")"
file:
(abc.com)
to
file:
abc.com
thank you for your help
__
Post your free ad now! http://personals.yahoo.ca
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe f
Hi all
How do I remove the backet "(" ")"
file:
(abc.com)
to
file:
abc.com
thank you for your help
__
Post your free ad now! http://personals.yahoo.ca
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe f