nixCraft Linux Forum

nixCraft

Linux Tech Support Forum

shell script to search specific file from txt file inside zip file and extract it

This is a discussion on shell script to search specific file from txt file inside zip file and extract it within the Shell scripting forums, part of the Development/Scripting category; Hi Guys, I wanted to search and extract specific file mentioned in .txt file from .zip in a file system. ...


Go Back   nixCraft Linux Forum > Development/Scripting > Shell scripting

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 05-31-2008, 01:39 AM
Junior Member
User
 
Join Date: May 2008
My distro: RedHat/Solaris
Posts: 6
Rep Power: 0
aasif.shaikh is on a distinguished road
Question shell script to search specific file from txt file inside zip file and extract it

Hi Guys,

I wanted to search and extract specific file mentioned in .txt file from .zip in a file system.

Eg;

test.zip is a file and inside that there are file 1.img 2.img 3.img 4.img and 5.img and I have a plain text file in that I had mentioned only 1 in 1st line and 5 on 2nd line; Now I wanted to search this matching pattern 1 and 5 and check in all *.zip file in file system and extract the one which matches.

Thanks in Advance.
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 05-31-2008, 04:37 PM
rockdalinux's Avatar
Contributors
User
 
Join Date: May 2005
Location: Bangalore
My distro: RHEL, HP-UX, Solaris, FreeBSD, Ubuntu
Posts: 554
Rep Power: 6
rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough
Default

No need to write a script.

Code:
unzip test.zip "*.img"
__________________
Rocky Jr.
You may have my body & soul, but you will never touch my pride!

If you have knowledge, let others light their candles at it.

Certified to work on HP-UX / Sun Solaris / RedHat
Reply With Quote
  #3 (permalink)  
Old 05-31-2008, 06:44 PM
Junior Member
User
 
Join Date: May 2008
My distro: RedHat/Solaris
Posts: 6
Rep Power: 0
aasif.shaikh is on a distinguished road
Default using for loop

Hey Rocky Jr.

Thnx for your reply but my problem is tht I want to read the file name which needs to be extracted from a plain text file. Like using for loop

Quote:
Originally Posted by rockdalinux View Post
No need to write a script.

Code:
unzip test.zip "*.img"
Reply With Quote
Reply

Bookmarks

Tags
unzip file , wildcard unzip


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Shell Script Searching For a Record In The File vinz4ever Shell scripting 1 05-11-2008 07:35 PM
word search in file chandanperl Coding in General 2 03-11-2008 10:16 AM
shell script for ftp the file vishal_titre Shell scripting 3 12-10-2007 08:40 AM
error shell script no such file or directory /bin/sh Linux software 1 01-08-2006 08:34 PM
Script to extract a specific row of data ricc Shell scripting 1 11-15-2005 02:29 PM


All times are GMT +5.5. The time now is 12:09 AM.


Powered by vBulletin® Version 3.7.2 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36