- 论坛徽章:
- 0
|
现有一文件 1.txt 其中内容为json 想替换其中内容
1.txt的内容为
{"ARCH":"armeabi-v7a_armeabi","BRAND":"SEMC","DEVICE":"LT22i","DISPLAY":"bc7b9baeda01","FINGERPRINT":"SEMC/LT22i_1261-9622/LT22i:4.0.4/6.1.B.0.544/371_zw:user/release-keys","HARDWARE":"st-ericsson","HOST":"ee030d31aeee","ID":"024d755160e2","MANUFACTURER":"Sony Ericsson","MODEL":"LT22i","PRODUCT":"LT22i_1261-9622","RELEASE":"4.0.4","SDK":"15","SERIAL":"3848e971","TAGS":"fc46b8a3ca10","TYPE":"5a450ddcd127","USER":"547b2649854c","connect_mode":"0","density":"2.0","densityDpi":"320","file_hook_package":"上_com.jiyoutang.dailyup","file_hook_package_open":"true","get":"M9615A-CEFWMAZM-2.0.128017","getAddress":"a9:82:97:e5:26:c1","getBSSID":"c6:f9:17:98:43:e7","getDeviceId":"352265057944855","getIpAddress":"192.168.1.37","getJiZhan":"9664_58283","getLine1Number":"18902133739","getMacAddress":"d9:fb:fc:98:cc:ce","getMetrics":"540x960","getNetworkCountryIso":"cn","getNetworkOperator":"","getNetworkOperatorName":"中国电信","getNetworkType":"4","getPhoneType":"2","getRadioVersion":"u8500-49020804-P2H_EC01\n","getSSID":"8f8207ac03","getSimCountryIso":"cn","getSimOperator":"46003","getSimOperatorName":"","getSimSerialNumber":"89860302062302260452","getSimState":"5","getString":"775243e496e0cd2d","getSubscriberId":"460030098662697","getSubtypeName":"CDMA","gps":"null","location_mode":"0","scaledDensity":"2.0","setCpuName":" riogrande","sign":"1965D6B8DD0113BB44092AEA31872152","xdpi":"345.0566","ydpi":"342.23157"}
想把其中 "8f8207ac03" 替换为 "\"8f8207ac03\""
不能以8f8207ac03为替换
因为8f8207ac03是不固定值
目前已知 "8f8207ac03" 替换为 "\"8f8207ac03\"" 的方法是 echo '"8f8207ac03"'|sed -r 's/"([^"]*)"/"\\"\1\\""/'
求整个文件替换 |
|