这是我的意见:
"a","b","c","d","","f"
预期产出:
","
基本上每发生一次""
,我都想用SELECT
faq.faq_id
, faq.title
, faq.status
, fv.metadesc
, fv.metakey
, fv.metakey
, faq.url_key
FROM faq
INNER JOIN
(SELECT
faq_id,
MAX(IF(attribute = 'metadesc',value,null)) metadesc,
MAX(IF(attribute = 'metakey',value,null)) metakey,
MAX(IF(attribute = 'meta_image', value, null)) meta_image
FROM faq_value
GROUP BY faq_id) fv
ON fv.faq_id = faq.faq_id
替换它。
另外,我想为 n 字段数量的 n 行运行命令。
我已尝试过以下命令
awk -F'"' -v OFS ='' ' {for(i = 2; i< = NF; i + = 2)gsub(",","",$ i)} 1' infile中
但它也删除了双引号,但这不是我要求的...... 我还需要双引号
答案 0 :(得分:1)
你可以试试这个
echo '"a","b","c","d",",","f"' | sed 's/,",",/,"",/g'
答案 1 :(得分:0)
也许这有效:
echo '"a","b","c","d",",","f"' | awk '{sub(/\42,\42,\42/,"\42,\42\42")}1'
"a","b","c","d","","f"