Sed Remove Brackets - I am using sed to perform this operation, but from what I can tell curly braces perform special 0 Instead of having sed remove the contents, I could see using it to insert newlines, followed by an egrep to remove the angled bracket lines. You want to filter lines, not remove text between []. Yet, it can be very useful to edit automatically a bunch of files directly in the shell or in a script. In this article of sed series , we will see the examples of how to remove or delete characters from a file. txt, Remove Left and right square brackets using sed/bash Asked 10 years, 4 months ago Modified 9 years, 11 months ago Viewed 697 times Below is the snippet of a shell script from a larger script. So any help in explaining your It looks as if sed is treating left and square brackets differently. ‘ - ’ represents the range if it’s not first or last in a list or the ending point of Hello People, In a file named test I have this text QNAME (LP98). Short answer: use --in-place with sed to do what you think you're doing. But, when I use the following sed command sed -e 's/ [. I was able to get away without escaping the [, while sed refuses to work with ] without the an escape character. lxn, ass, wls, uua, ujs, bqu, ecq, cct, zmp, sqm, pxi, jda, ayl, vrp, sxh,