0

I want to delete all "tags":[xxxxx] array in a JSON text string e.g. "aaa":"bbb","tags":[abcdefg],"ccc":"ddd"

I used grep to get the regular expression right

  1. tried this: grep \"tags\":\[.*\] ==> this didn't work
  2. tried this: grep \"tags\":\\[.*\] ==> this works

to escape the [ character in grep command, why two \ is required?

then I tried to use sed to replace "tags":[abcdefg]

sed s/\"tags\":\\[.*\]//g

it does not work.

Can someone give suggestion?

ecsk
  • 31
  • 1
  • 4

0 Answers0