Re: grouping in sed with OR operator in bash in one line

2010-12-10 Thread Toby
On Jul 20, 10:02 pm, pac...@kosh.dhis.org (Alan Curry) wrote: > In article > , > > Toby   wrote: > >Hi, > > >I would like to replace a a set of words by another word via sed. My > >first try was: > > >  echo "a cat or a dog" | sed 's/\(cat\)\|\(dog\)/PET/g' > > >I also tried some variations of thi

grouping in sed with OR operator in bash in one line

2010-12-09 Thread Toby
Hi, I would like to replace a a set of words by another word via sed. My first try was: echo "a cat or a dog" | sed 's/\(cat\)\|\(dog\)/PET/g' I also tried some variations of this. But all failed. For any help I would be very happy. Cheers, Toby P.S. some variations of the search pattern \(

Re: grouping in sed with OR operator in bash in one line

2010-12-09 Thread Alan Curry
In article , Toby wrote: >Hi, > >I would like to replace a a set of words by another word via sed. My >first try was: > > echo "a cat or a dog" | sed 's/\(cat\)\|\(dog\)/PET/g' > >I also tried some variations of this. But all failed. Works for me: $ echo "a cat or a dog" | sed 's/\(cat\)\|\(do