Sed special parsing

What is the shortest & right way to remove the string "[]" with a sed statement ?

echo 'whatever[]whatever' | sed ........

? :slight_smile:

Something like this?

sed 's/\[]//'

Yup :slight_smile:

---------- Post updated at 07:20 PM ---------- Previous update was at 07:13 PM ----------

Now another question :

When entering the following command

# echo 'whatever[]whatever' | sed 's/[[]]//'
whateverwhatever

if we consider :

[ [ ] ]
1 2 3 4

1) Which pair of bracket will be interpreted first ?

a) 14 ?
b) 13 ?
c) 24 ?
d) 23 ?

2) Could you find or build an example that demonstrate this ?

:smiley: