1

Hi Could someone help to explain the meaning of the following syntax? I know it is regex but I could not understand s#

sed -r "s#\{\"result\":\{\"status\":\"S\"\}\}##g" $data_get > $data

Kusalananda
  • 333,661
kimman
  • 111
  • Don't let the s# confuse you. It's the same as s/. They're just using a different delimiter than normal, i.e. # rather than /. – steve Jan 05 '20 at 11:57
  • In addition to the explanation about # from Steve and in the duplicates, if you're working with JSON data, it may be more reliable edited with jq than with sed. You may want to ask a separate question about that. Also, most of the backslashes are not needed in that expression. – Kusalananda Jan 05 '20 at 12:26
  • Indeed. I believe the line could be reduced to simply sed 's/{"result":{"status":"S"}}//g' $data_get > $data and achieve the same behaviour. – steve Jan 05 '20 at 12:35

0 Answers0