1

Is it possible to extract only part of a file from a .zip archive?

The file is plain text, and it is much bigger than available disk space. Is it possible to extract it in parts?

3
  • 1
    Extract to stdout (unzip -p on Linux), pipe through some other tool that extracts part of it (e.g. dd on Linux).
    – dirkt
    Jun 16, 2020 at 6:33
  • Ditto. Note dd operates on bytes and therefore it can split a text stream mid-line or even mid-character (for multibyte characters). A reasonable approach is to work with lines (e.g. tail -n +21 | head -n 10; or sed -n '21,30 p; 30 q', or some equivalent awk code). Extremely long lines may be rejected or mishandled, or they may make the size of the output exceed your expectations. Note a file with lines exceeding {LINE_MAX} bytes in length is not a text file in formal terms of POSIX. When you say "plain text", does it mean the lines are reasonably short for sure? Jun 16, 2020 at 7:03
  • Similar question on Unix & Linux: How to partially extract zipped huge plain text file?
    – sleske
    Jun 16, 2020 at 8:37

0

You must log in to answer this question.

Browse other questions tagged .