Q:

Unzip specific files from multiple zip files

I'm new to Unix and am trying to extract specific pattern filename from the multiple zip files. I'm using find to find the zip files, and then trying to extract files having the filename CTL in the zip file, a*b*zip.
$ unzip -jn 'find $source_dir -mtime -$st_d -daystart -iname "a*zip"' \
    *CTL* -d $target_dir`

Other than this I tried using:
$ find -type f -newermt $start_date \! -newermt $end_date -name "a*zip" \
    | while read filename; do unzip -d $target_dir; done;`

but this is extracting all the files, but I'm looking for only those files, which have filename CTL.

A:

You can simply do that using find -exec alone.
find . -type f -name '*.zip' -exec unzip {}  '*CTL*' -d "$target_dir" \;

Explanation: -exec will execute the following command on each file found where {} is substituted for the filename. The command must be terminated by ;. Use \; at the end (';' escaped with \) to avoid your shell from interpreting the ; for its own as a termination for find, instead it is passed to find as regular text.
Also, notice that it is a good practice to enclose file patterns in quotes when they are passed as arguments, i.e. '*CTL*' as opposed to just *CTL*. When doing so, you avoid letting your shell expand the filenames. For example, suppose in this case one of your zip files has CTL in its filename (say abcCTL.zip). If you use just *CTL* for the pattern, the shell will expand it and instead of passing a pattern to unzip, it will instead pass the filename abcCTL.zip, which is clearly not what you want.

