简体   繁体   中英

unzipping text/csv files from .zip file in linux

I have zip files containing text (pipe delimited csv) that i receive daily. 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. however, if i unzip it in Linux/redhat, the first half is valid csv but towards the second half the line breaks are misplaced. 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. You would see stranger results otherwise. Between linux and Windows I suspect line processing with different end of line characters. Preprocess your csv with dos2unix or something similar.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM