help-gnu-utils
[Top][All Lists]
Advanced

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

grouping in sed with OR operator in bash in one line


From: Toby
Subject: grouping in sed with OR operator in bash in one line
Date: Wed, 08 Dec 2010 15:03:59 -0000
User-agent: G2/1.0

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
\(cat|dog\)
\(\(cat\)\|\(dog\)\)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]