I have the following two lines that work ok:

/\.to <\=/ s/<\=/be <\=/
/\.to_not <\=/ s/<\=/be <\=/

I would like to combine them and I tried:

/\.to( |_not )<\=/ s/<\=/be <\=/

but it doesn't match. What should I change?

I also tried /\.to(\s|_not )<\=/ s/<\=/be <\=/


In sed, you must escape the parentheses and |.

/\.to\( \|_not \)<\=/ s/<\=/be <\=/

Alternatively, in your example you could use ? (also escaped):

/\.to\(_not\)\? <\=/ s/<\=/be <\=/
  • 1
    but you don't need to escape the = – rici Nov 14 '13 at 23:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.