How to remove pattern containing blank space and special characters in sed

Posted on

Problem :

How to remove following words from a text file:

  1. DEFAULT ('')
  2. DEFAULT ((0))
  3. DEFAULT (((1)/(1))/(1900))
  4. DEFAULT (getdate())

I am not able to delete above four pattens using sed.

Solution :

You cannot do that with sed or generally with a regular expression. Identifying a closing parenthesis requires a parser which you might implement in awk, python, perl or whatever language.

See for example

Leave a Reply

Your email address will not be published. Required fields are marked *