我有以下字符串:
{"name":"ram","details":[{'subjects':{'service_location':'c:/A.exe','url':'http://A.zip'}}]}
Run Code Online (Sandbox Code Playgroud)
在上面的字符串中,很少有字符串周围有单引号。那么,如何在上面的字符串中用双引号替换单引号并得到如下结果:
{"name":"ram","details":[{"subjects":{"service_location":"c:/A.exe","url":"http://A.zip"}}]}
Run Code Online (Sandbox Code Playgroud)
@Learner:尝试一个sed解决方案:
sed "s/'/\"/g" Input_file
Run Code Online (Sandbox Code Playgroud)
或者
your_command | sed "s/'/\"/g"
Run Code Online (Sandbox Code Playgroud)