i have zip folder contains multiple files of same format. each file around 50 mb size. need split each file multiple chuncks (say 1000 lines per spllited output file).
i have written shell script which unzips folder , saves split files output in directory.
the problem output chunks in unreadable format containing symbols , random characters. when each file individually, outputs perfect txt split files. not happening whole zip folder.
anyone knows how can files in txt format. here script.
for z in input.zip ; if unzip -p "$z" | split -l 1000 $z output_dir ; echo "$z" fi done
problem
you need unzip files first. otherwise, chunking original binary zip file.
solution
the following untested because don't have source file. however, should work little tweaking.
unzip -d /tmp/unzipped input.zip mkdir /tmp/split_files file in /tmp/unzipped/*txt do; split -l 1000 "$file" "/tmp/split_files/$(basename "$file" .txt)" done
Comments
Post a Comment