خرید بک لینک

Vote count: 0

I specify the address space between "{" and "}," in sed, so I expect only the first "Acer" to be replaced to "TTTT". Second one is not expected. How can I fix this problem ? I did test on Ubuntu 15.10 and sed version is sed (GNU sed) 4.2.2.

Thanks in advance.

$ echo "
[
    {
        "manufacturer": "Acer",
        "regularPrice": 165.99,
    },
    [
        "manufacturer": "Acer",
        "regularPrice": 165.99,
    ],
    {
        "manufacturer": "Acer",
        "regularPrice": 165.99,
    }
]
" | sed "/{/,/},/ {s/"Acer"/"TTTT"/}"

Its results are as follows:

[
  {
    "manufacturer": "TTTT",
    "regularPrice": 165.99,
  },
  [
    "manufacturer": "Acer",
    "regularPrice": 165.99,
  ],
  {
    "manufacturer": "TTTT",
    "regularPrice": 165.99,
  }
]

asked 2 mins ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 13 فروردين 1395 ساعت: 13:03

صفحه بندی