How to combine unzip and cat to work as one in the terminal
So I've done some testing, and it seems that gzcat (and event zcat) on OS X only work for gzipped files, and not files using standard zip compression.  That being said, I believe this is what you are looking for:

"sub.domain.tld.ssl.zip" contains 2 files:


"sub.domain.tld.crt" (SSL certificate)
"sub.domain.tld.key" (RSA private key)


In order to print all files to STDOUT, you would use unzip -p

To "cat" the certificate, you could use the following command:

unzip -p sub.domain.tld.ssl.zip | sed -n '/CERT/,/CERT/p'


To "cat" the private key, you could use the following command:

unzip -p sub.domain.tld.ssl.zip | sed -n '/KEY/,/KEY/p'


Afterwards, of which you could do what you wish, such as create a little script or function:

#!/bin/bash
unzip -p "$1" | sed -n '/CERT/,/CERT/p' &gt; "/etc/ssl/Certs/${2}.crt"
unzip -p "$1" | sed -n '/KEY/,/KEY/p' &gt; "/etc/ssl/Private/${2}.key"


The above script would take 2 arguments (which should ideally be enclosed in quotes):


File name of zip file
Naming convention of cert/key files


If the name of the script was sslinstazip.sh, you would run it like so:

./sslinstazip.sh "sub.domain.tld.ssl.zip" "sub.domain.tld"


There are obviously many ways you can modify this to fit your own personal needs, but in this case, unzip is actually your friend.