.csv文件问题与unix中的拆分行,而不是Windows

时间:2010-02-05 19:11:15

标签: ftp split csv

遇到了问题我确定以前遇到过某个人。我们一直在将客户.csv文件FTP到我们的笔记本电脑,然后将它们运行到我们的Oracle数据库,但网络使它成为一个缓慢的过程..我设置了一个shell脚本,将这些文件LFTP到Solaris数据库框,并且sqlload他们 - 快得多。有一些角色问题,所以我能够改变NLS_LANG,现在看到数据库中的字符与我们进入Windows路径时相同。这7个文件中有2个有问题。在500,000条记录中,有几千条写入.bad文件,因为行是分开的。好奇,在Windows环境中,这不会发生。不确定这是一个FTP与LFTP的事情,还是在进入UNIX时发生的字符集转录(MSWIN - > WE8ISO)想想可能有一个set变量可能会使LFTP在这方面表现得更像FTP ......有什么想法吗?

我的创可贴替代品如果我无法弄清楚上面的真正问题,那就是在操作分割线后重新加载2 .bad文件到上一行的末尾。这是.bad文件中拆分记录的示例。他们似乎总是分裂在这个地址字段,通常是应该有点或逗号的地方 - 在'215 St'处看到换行符:

"","","1-1000035","","","1-1000035","SIS STRATEGIC INFORMATION SYSTEMS","SIS STRATEGIC INFORMATION SYSTEMS","","RESELLER","Active","N","Y","","","","","","$"
,"","","","","","","","80","","","","","","","","","","","","","(403) 281-4252","(780) 701-4050","North America","","","11432 215 St
Summerbarn Rd","","","Edmonton","AB","T2S3Y5","Canada","","","","","","1-1000035","","","","","","","","","","","","",
"","","","","",,,,"",,0,"UPSERT",10,"Y","Inserted By Widget",2009-10-23 15:08:03.387000000,2009-10-23 15:08:03.387000000,"",,"",,"","","1-1000035"^M

1 个答案:

答案 0 :(得分:0)

它可能是Unix和Windows行结尾之间的区别(\ n与\ r \ n)?