cancel
Showing results for 
Search instead for 
Did you mean: 

Re: simple sed I hope

 
SOLVED
Go to solution
Super Advisor

simple sed I hope

Hi all,

If I have a string (106.9.33.22) how can I simply strip the brackets from the output!!

Cheers
4 REPLIES 4
Respected Contributor
Solution

Re: simple sed I hope

sed -e 's/(//' -e 's/)//'
Honored Contributor

Re: simple sed I hope

If you don't care for parens at all,
then how about

tr -d '[()]'
Madness, thy name is system administration
Acclaimed Contributor

Re: simple sed I hope

Similar to Ian's solution, you could of course strip all parenthesis with one RE:
sed -e 's/[()]//' file
Honored Contributor

Re: simple sed I hope

If the file were to contain any other parens, tehn you may want to limit your replace to those parens surrounding numbers and dots (ip addresses?).

sed -e 's/(\([0-9.]\+\))/\1/' file


Hein