Replace all double quotes with single quotes

后端 未结 3 1636
一向
一向 2020-12-08 01:46

I\'m trying to replace all double quotes in a string with single quotes. here my expression:

echo \"

        
相关标签:
3条回答
  • 2020-12-08 02:28

    You could use tr here, concise and less of quoting headache:

    tr '"' "'"
    
    0 讨论(0)
  • 2020-12-08 02:33

    You need to pass the g flag to sed:

    sed "s/\"/'/g"
    
    0 讨论(0)
  • 2020-12-08 02:34

    This might work for you:

    sed "y/\"/'/" file
    
    0 讨论(0)
提交回复
热议问题