0

I have a zip archive (let's call it archive) and let's say I want to go through some directories and finally extract ONLY the files that start with the word 'word'. Some thing similar to:

archive.zip/dir1/dir2/word***.csv

What is the command that could do this without having to extract the whole file (very big file)?

I tried this command line:

unzip -p archive.zip dir1/dir2/word***1.csv >destination

But this only extracts one file not all files that start with 'word'

mobelahcen
  • 414
  • 5
  • 22

1 Answers1

2

You should do

unzip -p archive.zip dir1/dir2/word*1.csv >>destination.csv

The > truncates file destination.csv to zero length giving you the impression that only one file was unzipped, while >> creates the file if not present, otherwise appends to it which is the required behavior.

Reference : Check I/O redirection

sjsam
  • 21,411
  • 5
  • 55
  • 102