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



这是我的输入:

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

预期输出:

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

基本上,对于每一个出现的",",我都想用""来代替它。此外,我还想为n的行数运行命令,为n的字段数运行命令。

我已经尝试了以下命令

awk-F'"-v OFS="{对于(i=2;i<=NF;i+=2)gsub(",",",$i)}1'内卷

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

你可以试试这个

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

也许这是有效的:

echo '"a","b","c","d",",","f"' | awk '{sub(/42,42,42/,"42,4242")}1'
"a","b","c","d","","f"

相关内容

  • 没有找到相关文章

最新更新