Using unzip I'm attempting to extract the first 1000 lines from an xml file. From reading How to partially extract zipped huge plain text file? I've used the answers to create:
unzip -p my_feed.zip | dd count=1000 > out.txt which is close to what I'm trying to achieve.
man dd describes :
count=n Copy only n input blocks. What is the size of an input block ? How to extract the first 1000 lines instead of first 1000 input blocks ?
Update:
I forgot to mention I'm using osx. I thought this would achieve same result:
gunzip < my_feed.zip | head -n 1000 but returns error:
gunzip: unknown compression format
file my_feed.zipand post the report it gives. GNU gunzip should work with zip files on Linux, but only if they contain a single file compressed with 'deflation' mode.unzip -c my_feed.zip desired_file | head -n 1000 > out1000.txtfile), or that there is a single file (as shown byunzip -tv), then I suggest you specify a single filename from the archive. gunzip should work with a single file, so I assume the file is either multi-file or corrupt. I note your OP used unzip with dd, and then gunzip with head, and wondered why you didn't try unzip with head anyway.