0

Suppose I have a file (say a.txt) whose text reads :

{I have a dream today}

I want to replace the braces so that the file a.txt now looks like :

I have a dream today

I tried using the sed expression sed -i {s/{}//g}, but it doesn't work. Is there a smart way to do this?

Thanks in advance.

  • Related: [What special characters must be escaped in regular expressions?](https://stackoverflow.com/q/399078/8344060) – kvantour Aug 25 '20 at 08:15

1 Answers1

3

In this scenario you want to use a character class, and include both brackets { and } in it:

sed -i 's/[{}]//g' a.txt
Paolo
  • 21,270
  • 6
  • 38
  • 69