unzip single file in zip file to STDOUT


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers unzip single file in zip file to STDOUT
# 1  
Old 03-29-2010
unzip single file in zip file to STDOUT

Hi,

Does anyone know if there is an unzip command similar to

tar -xOf $tarBall $fileInTarFile

which will untar a single file in a tar ball to STDOUT ?
I want to do the same but with a .zip (ZIP archive) file.

- Andy

---------- Post updated at 05:56 PM ---------- Previous update was at 05:30 PM ----------

Figured it out...

unzip -p $zipFile $fileInZipFile
or
unzip -c $zipFile $fileInZipFile (includes archive file and original filename in header)

will do it, just specify the filename in the zip file after

---------- Post updated at 06:20 PM ---------- Previous update was at 05:56 PM ----------

I know it's a little messy but I found the following useful to get a list of files in a ZIP archive

Code:
unzip -l file_name.zip|awk -F" " '{print $4}'|grep -v "^$"|tail +3l

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How can we Zip multiple files created on the same date into one single zip file.?

Hi all i am very new to shell scripting and need some help from you to learn 1)i have some log files that gets generated on daily basis example: i have abc_2017_01_30_1.log ,2017_01_30_2.log like wise so i want to zip this 4 logs which are created on same date into one zip folder. 2)Post zipping... (1 Reply)
Discussion started by: b.saipriyanka
1 Replies

2. UNIX for Beginners Questions & Answers

How can we Zip multiple files created on the same date into one single zip file.?

Hi all i am very new to shell scripting and need some help from you to learn 1)i have some log files that gets generated on daily basis example: i have abc_2017_01_30_1.log ,2017_01_30_2.log like wise so i want to zip this 4 logs which are created on same date into one zip folder. 2)Post zipping... (2 Replies)
Discussion started by: b.saipriyanka
2 Replies

3. Shell Programming and Scripting

Unzip the .zip file without using unzip utility in UNIX

I have .zip file, i want to list all the files archived in the zip file. unzip utility is not working for me in unix. Please help me resolve this issue Thanks ganesh. (3 Replies)
Discussion started by: Ganesh L
3 Replies

4. Shell Programming and Scripting

How to Unzip a file using unzip utility for files zipped without zip utility ?

Hi, I need to zip/compress a data file and send to a vendor. The vendor does have only unzip utility and can accept only .ZIP files. I do not have zip utility in my server. How do I zip/compress the file so that it can be deflated using unzip command ? I tried gzip & compress commands, but... (1 Reply)
Discussion started by: Sabari Nath S
1 Replies

5. Shell Programming and Scripting

unzip .zip file in unix

Hi friends, I have a .zip file which has 6 pdf files. I have ftp'd the .zip file into unix and I am trying to uncompress/unzip the file. Could you please help with the right command. Thanks (7 Replies)
Discussion started by: techmoris
7 Replies

6. Shell Programming and Scripting

How to Unzip a .ZIP file in Unix without using unzip cmd..?????

Hi All I have ftped a .ZIP file (zipped using WinZip in Windows) to my Unix server (HP-UX). I don't have unzip cmd available in my curent Unix version Please let me know any cmd in UNIX (other than unzip) using which I can unzip this .ZIP file . Please elaborate on the commands aval and... (5 Replies)
Discussion started by: sureshg_sampat
5 Replies

7. UNIX for Dummies Questions & Answers

unzip .zip file and list the files included in the .zip archive

Hello, I am trying to return the name of the resulting file from a .zip archive file using unix unzip command. unzip c07212007.cef7081.zip Archive: c07212007.cef7081.zip SecureZIP for z/OS by PKWARE inflating: CEP/CEM7080/PPVBILL/PASS/G0063V00 I used the following command to unzip in... (5 Replies)
Discussion started by: oracledev
5 Replies

8. HP-UX

How to Unzip a .ZIP file in Unix without using unzip cmd..?????

Hi All I have ftped a .ZIP file (zipped using WinZip in Windows) to my Unix server (HP-UX). I don't have unzip cmd available in my curent Unix version Please let me know any cmd in UNIX (other than unzip) using which I can unzip this .ZIP file . Please elaborate on the commands aval and... (5 Replies)
Discussion started by: sureshg_sampat
5 Replies

9. UNIX for Advanced & Expert Users

How to unzip a .zip file when

there is no unzip package present. (2 Replies)
Discussion started by: yogesh_powar
2 Replies

10. UNIX for Dummies Questions & Answers

unzip a zip file

hello everyone, i have a dumb question...how do i unzip a zip file?? it has an .zip extension... thanks xNYx (4 Replies)
Discussion started by: xNYx
4 Replies
Login or Register to Ask a Question
FUNZIP(1)						      General Commands Manual							 FUNZIP(1)

NAME
funzip - filter for extracting from a ZIP archive in a pipe SYNOPSIS
funzip [-password] [input[.zip|.gz]] ARGUMENTS
[-password] Optional password to be used if ZIP archive is encrypted. Decryption may not be supported at some sites. See DESCRIPTION for more details. [input[.zip|.gz]] Optional input archive file specification. See DESCRIPTION for details. DESCRIPTION
funzip without a file argument acts as a filter; that is, it assumes that a ZIP archive (or a gzip'd(1) file) is being piped into standard input, and it extracts the first member from the archive to stdout. When stdin comes from a tty device, funzip assumes that this cannot be a stream of (binary) compressed data and shows a short help text, instead. If there is a file argument, then input is read from the speci- fied file instead of from stdin. A password for encrypted zip files can be specified on the command line (preceding the file name, if any) by prefixing the password with a dash. Note that this constitutes a security risk on many systems; currently running processes are often visible via simple commands (e.g., ps(1) under Unix), and command-line histories can be read. If the first entry of the zip file is encrypted and no password is specified on the command line, then the user is prompted for a password and the password is not echoed on the console. Given the limitation on single-member extraction, funzip is most useful in conjunction with a secondary archiver program such as tar(1). The following section includes an example illustrating this usage in the case of disk backups to tape. EXAMPLES
To use funzip to extract the first member file of the archive test.zip and to pipe it into more(1): funzip test.zip | more To use funzip to test the first member file of test.zip (any errors will be reported on standard error): funzip test.zip > /dev/null To use zip and funzip in place of compress(1) and zcat(1) (or gzip(1) and gzcat(1)) for tape backups: tar cf - . | zip -7 | dd of=/dev/nrst0 obs=8k dd if=/dev/nrst0 ibs=8k | funzip | tar xf - (where, for example, nrst0 is a SCSI tape drive). BUGS
When piping an encrypted file into more and allowing funzip to prompt for password, the terminal may sometimes be reset to a non-echo mode. This is apparently due to a race condition between the two programs; funzip changes the terminal mode to non-echo before more reads its state, and more then ``restores'' the terminal to this mode before exiting. To recover, run funzip on the same file but redirect to /dev/null rather than piping into more; after prompting again for the password, funzip will reset the terminal properly. There is presently no way to extract any member but the first from a ZIP archive. This would be useful in the case where a ZIP archive is included within another archive. In the case where the first member is a directory, funzip simply creates the directory and exits. The functionality of funzip should be incorporated into unzip itself (future release). SEE ALSO
gzip(1), unzip(1), unzipsfx(1), zip(1), zipcloak(1), zipinfo(1), zipnote(1), zipsplit(1) URL
The Info-ZIP home page is currently at http://www.info-zip.org/pub/infozip/ or ftp://ftp.info-zip.org/pub/infozip/ . AUTHOR
Mark Adler (Info-ZIP) Info-ZIP 20 April 2009 (v3.95) FUNZIP(1)