When I do unzip -l zipfilename
, I see
1295627 08-22-11 07:10 A.pdf
473980 08-22-11 07:10 B.pdf
...
I only want to see the filenames. I try this
unzip -l zipFilename | cut -f4 -d" "
but I don't think the delimiter is just " "
.
When I do unzip -l zipfilename
, I see
1295627 08-22-11 07:10 A.pdf
473980 08-22-11 07:10 B.pdf
...
I only want to see the filenames. I try this
unzip -l zipFilename | cut -f4 -d" "
but I don't think the delimiter is just " "
.
If you need to cater for filenames with spaces, try:
Use awk:
The easiest way to do this is to use the following command:
or
This will list only the file names, one on each line.
The two commands are exactly equivalent. The
-Z
option tells unzip to treat the rest of the options as zipinfo options. See the man pages for unzip and zipinfo.Assuming none of the files have spaces in names:
My unzip output has both a header and footer, so the awk script becomes:
A version that handles filenames with spaces: