[英]unzipping text/csv files from .zip file in linux
I have zip files containing text (pipe delimited csv) that i receive daily. 我有包含每天收到的文本(以竖线分隔的csv)的zip文件。 The file has to be bulk loaded to a database.
该文件必须批量加载到数据库中。 When i unzip them using winrar or any tool in windows the file is valid.
当我使用winrar或Windows中的任何工具解压缩它们时,该文件有效。 however, if i unzip it in Linux/redhat, the first half is valid csv but towards the second half the line breaks are misplaced.
但是,如果我在Linux / redhat中将其解压缩,则前半部分是有效的csv,但到后半部分,换行符的位置不正确。 Some of the fields are even reordered.
一些字段甚至被重新排序。
I am running: 我在跑步:
unzip -o zipfile.zip -d newfilepath
Tried: 尝试过:
unzip -oa zipfile.zip -d newfilepath
and 和
unzip -od zipfile.zip -d newfilepath
Your zipfile is probably OK. 您的zip文件可能还可以。 You would see stranger results otherwise.
否则,您会看到陌生人的结果。 Between linux and Windows I suspect line processing with different end of line characters.
在Linux和Windows之间,我怀疑行处理具有不同的行尾字符。 Preprocess your csv with dos2unix or something similar.
用dos2unix或类似的东西预处理您的csv。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.