I need your help to find out an easy way to untar files from a tar file.
For example, I have a tar file which contains a lot of files that needs to untar in certain directories. I would like to untar them using one command instead of typing the following commands which is taking lots of time. Is there an easy way to do that?
tar -xvf ABC.tar bin/file1
tar -xvf ABC.tar bin/name
tar -xvf ABC.tar bin/address
tar -xvf ABC.tar bin/status
tar -xvf ABC.tar bin/city
tar -xvf ABC.tar bin/country
�����������
�����������
tar -xvf ABC.tar lib/file7
tar -xvf ABC.tar lib/post
tar -xvf ABC.tar lib/get
Thanks for your quick response. I have about 35 files in bin and 74 files in lib to untar. I think I can put them in a input file then run it as following...
for i in `ls tar_list`
do
tar -xvf ABC.tar $i
done
As for how to feed all those filenames into tar, if none of the files contain spaces or quotes in filenames, it's easy enough, use xargs. "echo a b c | xargs command" amounts to "command a b c", and it can read from a file.
xargs tar -xvf filename.tar < tar_list
If possible it will squeeze it alll into one tar call, but for too many files, it may have to break it into a few.