gpt4 book ai didi

linux - 仅删除逗号分隔文件中引号之间的逗号

转载 作者:太空宇宙 更新时间:2023-11-04 05:43:12 24 4
gpt4 key购买 nike

这是我的输入:

"a","b","c","d",",","f"

预期输出:

"a","b","c","d","","f"

基本上,对于每个出现的 ",",我想将其替换为 ""。另外,我想运行命令 n 行或 n 个字段。

我尝试过以下命令

awk -F'"' -v OFS='' '{ for (i=2; i<=NF; i+=2) gsub(",", "", $i) } 1' infile

但它也删除了双引号,但这不是我所需要的......我还需要双引号

最佳答案

你可以试试这个

echo '"a","b","c","d",",","f"'  | sed 's/,",",/,"",/g'

关于linux - 仅删除逗号分隔文件中引号之间的逗号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38568180/

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