General
cancel
Showing results for 
Search instead for 
Did you mean: 

Re: Extracting a particular files from a TAR file

 
SOLVED
Go to solution
Pando
Regular Advisor

Extracting a particular files from a TAR file

Dear Gurus,

i have a TAR files which contans different files in it. I would like to ask on how to extract all files beginning with prefix BLF4G20LS from the TAR files to another directory.

Maximum point for all correct replies!
2 REPLIES 2
Mel Burslan
Honored Contributor

Re: Extracting a particular files from a TAR file

cd /directory/to/extract/into
for file in `tar -tvf mytarfile.tar|awk {'print $8'}`
do
tar -xvf mytarfile.tar $file
done


Hope this helps
________________________________
UNIX because I majored in cryptology...
lawrenzo
Trusted Contributor
Solution

Re: Extracting a particular files from a TAR file

should this be:

cd /directory/to/extract/into
for file in `tar -tvf mytarfile.tar|grep BLF4G20LS|awk {'print $8'}`
do
tar -xvf mytarfile.tar $file
done

??
hello