我想逐行读取数据,在哪里找到双引号,我想用空格替换换行符,直到遇到第二个双引号,如
090033ec82b13639,CPDM Initiated,Logistical,"There corrected.",Gul Y Serbest,Urology
090033ec82ae0c07,Initiated,NA,"
To local testing Rohit 3 to 4.",Julienne B Orr,Oncology
090033ec82b35fd0,Externally Initiated,NA,regulatory agency requests,Kenneth A Lord,Oncology
就像上面的数据第二行一样,它在第三行中找到双引号(打开)并关闭双引号,因此我们需要将这些行合并为一个空格,如下所示:
> 090033ec82b13639,CPDM Initiated,Logistical,"There corrected.",Gul Y
> Serbest,Urology 090033ec82ae0c07,Initiated,NA,"To local testing
> Rohit 3 to 4.",Julienne B Orr,Oncology 090033ec82b35fd0,Externally
> Initiated,NA,regulatory agency requests,Kenneth A Lord,Oncology
在linux命令中,操作系统是solaris
awk '/^"/ {if (f) print f; f=$0; next} {f=f FS $0} END {print f}' file
sed -r 'H;1h;$!d;x; :a; s/(\t *"[^"]*)\n/\1 /; ta' file