Bash 删除字符串中的双引号

Bash 删除字符串中的双引号,bash,sed,Bash,Sed,我想删除字符串中的双引号,这样当我使用双引号作为分隔符时,它不会给出额外的列 例如: 输入: "t3_2qys9a","YamahaR","\"The thing wouldn't shut so I screwed it shut.\" That's when I said in my head, \"There was a recall for this from ford, Sachin.\"", "Justrolledintothesho" 输出: "t3_2qys9a", "Yama

我想删除字符串中的双引号,这样当我使用双引号作为分隔符时,它不会给出额外的列

例如:

输入:

"t3_2qys9a","YamahaR","\"The thing wouldn't shut so I screwed it shut.\" That's when I said in my head, \"There was a recall for this from ford, Sachin.\"", "Justrolledintothesho"
输出:

"t3_2qys9a", "YamahaR", "The thing wouldn't shut so I screwed it shut. That's when I said in my head, There was a recall for this from ford, Sachin.", "Justrolledintothesho"
我尝试使用sed,但它删除了所有双引号

cat sample.txt | sed 's/\"/""

假设逗号后添加的空格是偶然的,则应删除文件中所有转义的双引号:

sed 's/\\\"//g' sample.txt

您首先声明要删除
,“
”,然后显示一个示例,其中删除了
\“
和一些
(并添加了一些空格)。你能澄清一下你想做什么吗?很抱歉,我发布了两个问题,所以我想在这里删除双引号。我会编辑它。谢谢。我假设添加了空格(例如,
“t3_2qys9a”,“
而不是
“t3_2qys9a”,“
)也是偶然的吗?如果是,您只是在寻找一个全局删除
\“
”?请使用不太冒犯性的文本作为示例;自动检测粗鲁行为的探测器在你的邮件上绊倒了。只需使用“Mary有一只小羊羔”或其他什么。您的输出在前两个
后面添加了一个空格,用于分隔字段。你是想把它包括在sed操作中吗?@RaviSaroch:当然-这没有什么坏处,而且我更清楚。我只是有点好奇为什么“双”或“三”反斜杠不会影响结果。我想说,使用不必要的反斜杠更不清楚。只要逃过一次就够了。所以使用sed的//\\“//g'