在导入数据仓库服务器之前,我需要将 mysql 转储文件转换为 CSV 格式。
INSERT INTO `temp` VALUES (30686631,1346959848246,1346959850865,1346959998054,'18663196147','18663196147','18668839208','17326812123',3372579,'1866319614700','A',1,'','',0,147,30686632,'KeyAd','1101','38.325.Monitor2.1101@10.40.10.170','10.40.10.40',5060,'10.40.10.46',5060,'100038455383251101_Monitor2@10.40.10.170','<sip:+18668839208@10.40.10.46:5060>;tag=sansay507370834rdb810','\"O\'HALLORAE,AEAN\" <sip:+17326812123@10.40.10.40;isup-oli=00>;tag=sansay507370829rdb1779','200',0,'',0,NULL,'','',3398812,NULL,NULL);
我正在使用此命令删除 mysql insert 语句
sed -e 's/^INSERT INTO `temp` VALUES (//' -e 's/);$//' -e 's/(//;s/);//;s/,/|/g;s|["'\'']||g'
当名称出现在两个斜杠 \ \ 之间时,它们似乎存在问题,我不知道如何解决它。
从 MySQL 插入
'\"O\'HALLORAE,AEAN\"
无法弄清楚如何形成输出
"O'HALLORAN,SEAN"
期望的输出:
30686631|1346959848246|1346959850865|1346959998054|18663196147|18663196147|18668839208|17326812123|3372579|1866319614700|A|1|||0|147|30686632|KeyAd|1101|38.325.Monitor2.1101@10.40.10.170|10.40.10.40|5060|10.40.10.46|5060|100038455383251101_Monitor2@10.40.10.170|<sip:+18668839208@10.40.10.46:5060>;tag=sansay507370834rdb810| "O'HALLORAN,SEAN" <sip:+17326812123@10.40.10.40;isup-oli=00>;tag=sansay507370829rdb1779|200|0||0|NULL|||3398812|NULL|NULL