[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: sed question.



Carlos Hanson wrote:
On Fri, 04 Jun 2004 10:31:07 -0400
Ralph Crongeyer <ralph@crongeyer.com> wrote:

  
Hi all,
I need to do a pattern match with sed of "(" and  ")". I need to replace 
every ( with "(" and every ) with ")" on every line.

Can someone help me with this?

Thanks

Ralph

    
sed 's/[()]/"&"/g'

Here is the test I used:

$ echo "This (is) a (test) of (())" | sed 's/[()]/"&"/g'      
This "("is")" a "("test")" of "(""("")"")"


  
Carlos, Thanks!
By the way, what does the & mean?

Ralph

Reply to: