我有一个 txt 文件,其中包含带引号的逗号分隔文本,我试图弄清楚正在使用哪种类型的换行符。
原因是因为我正在尝试使用本地 infile 将其导入 mysql 服务器,显然我需要告诉它正确的 LINES TERMINATED BY
当我使用 \n 或 \r\n 时,它只导入一半的记录,每次都跳过一行。
但是,当我使用 \r 时,它会完全导入两倍,因为有记录,所以给我确切的行数,因为所有值都为 null。
当我在记事本中打开文件时,行之间没有空格,但是,如果我在浏览器中打开它,每行之间都有一个空行,就好像某处有一个段落一样。同样明智的是,如果我选择“使用 > Excel 打开”,它不会放入列中,并且每个列之间都有一个空行。在 excel 中正确打开的唯一方法是使用“获取外部数据 > 从文本”并选择逗号分隔符。
我仅通过复制和粘贴就在下面提供了几行,显然,如果有人可以让我知道用于导入的正确设置,那就太好了。但是,如果有一种方法可以让我快速了解任何特定文件正在使用哪种类型的换行符,那就更好了(根据其他行,文件的最后还有一个空行)。
"Item No.","Description","Description 2","Customers Price","Home stock","Brand Name","Expected date for delivery","Item Group No.","Item Group Name","Item Product Link (Web)","Item Picture Link (Web)","EAN/UPC","Weight","UNSPSC code","Product type code","Warranty"
"/5PL0006","Drum Unit","DK-23","127.00","32","Kyocera","04/11/2013","800002","Drums","http://uk.product.com/product.aspx?id=%2f5PL0006","http://s.product.eu/products/2_PICTURE-TAKEN.JPG","5711045360824","0.30","44103109","","3M"
"/DK24","DK-24 Drum Unit FS-3750","","119.00","8","Dell","08/11/2013","800002","Drums","http://uk.product.com/product.aspx?id=%2fDK24","http://s.product.eu/products/2_PICTURE-TAKEN.JPG","5711045360718","0.20","44103109","","3M"