linux - Replace "[ to [ with sed -


i have file:

 "tags": "['pnp']" 

clearly "[ wrong, must ot "tags" : ['pnp']

so wanna replace sed:

sed -i "1,$ s/"[/[/g" file.json 

however told me not match

how can it?

you can do

sed 's/"\[/\[/; s/\]"/\]/' file.json 

the brackets [] special characters in basic regular expressions, need escape them.

on input:

"tags": "['pnp']" 

this outputs:

"tags": ['pnp'] 

Comments