मैं स्ट्रीम एडिटर सेक्शन का उपयोग कर रहा हूं ताकि टेक्स्ट फाइल डेटा (400 एमबी) का एक बड़ा सेट एक सीएसवी प्रारूप में परिवर्तित हो सके।sed - बड़ी सीएसवी फाइलों में उद्धरणों के भीतर उद्धरण हटाएं
मैं खत्म करने के लिए बहुत करीब आ गए हैं, लेकिन बकाया समस्या इस तरह एक डेटा पर उद्धरण के भीतर उद्धरण हैं,:
1,word1,"description for word1","another text",""text contains "double quotes" some more text"
2,word2,"description for word2","another text","text may not contain double quotes, but may contain commas ,"
3,word3,"description for "word3"","another text","more text and more"
वांछित आउटपुट है:
1,word1,"description for word1","another text","text contains double quotes some more text"
2,word2,"description for word2","another text","text may not contain double quotes, but may contain commas ,"
3,word3,"description for word3","another text","more text and more"
मैं चारों ओर खोज की है मदद के लिए, लेकिन मुझे समाधान के बहुत करीब नहीं मिल रहा है, मैंने रेगेक्स पैटर्न के साथ निम्नलिखित seds को आजमाया है:
sed -i 's/(?<!^\s*|,)""(?!,""|\s*$)//g' *.txt
sed -i 's/(?<=[^,])"(?=[^,])//g' *.txt
.txt
मूल फ़ाइलें हैं * और मैं के साथ जगह में उन्हें संपादित करने के कोशिश कर रहा हूँ: ५३६९१३६३२१०
ये नीचे दिए गए प्रश्नों से हैं, लेकिन sed के लिए काम करने नहीं लग रहे एसईडी।
वांछित आउटपुट क्या है? –
मैंने इसे अपडेट किया है, धन्यवाद। – nol