如何僅獲得值“GET”?
$ echo '"parameters":[],"method":"GET","uri":"example.com/abc/def/"' | sed 's/\"method\":\(.*\)\,/\1/'
這洗掉了“方法”:但我也需要洗掉引數的鍵/值對和uri。這是結果
"parameters":[],"GET""uri":"example.com/abc/def/"
uj5u.com熱心網友回復:
我可能已經想通了。
$ echo '"parameters":[],"method":"GET","uri":"example.com/abc/def/"' | sed 's/^.*\"method\":\(.*\)\,.*$/\1/g
請隨時提出更好的答案。
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/511280.html
標籤:json变量sed替代
上一篇:從函式中獲取新變數
