gpt4 book ai didi

bash - 如何在bash中将单引号替换为双引号?

转载 作者:行者123 更新时间:2023-12-04 18:35:17 26 4
gpt4 key购买 nike

我有以下字符串:

 {"name":"ram","details":[{'subjects':{'service_location':'c:/A.exe','url':'http://A.zip'}}]}

在上面的字符串中,很少有字符串有单引号。那么,如何在上面的字符串中用双引号替换单引号并得到如下:
 {"name":"ram","details":[{"subjects":{"service_location":"c:/A.exe","url":"http://A.zip"}}]}

最佳答案

@Learner:试试 sed解决方案:

sed "s/'/\"/g"  Input_file

或者
your_command | sed "s/'/\"/g" 

关于bash - 如何在bash中将单引号替换为双引号?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42001148/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com