simple tar xvf question
Hi guys,
I'm trying to untar a file "tarfile.tar" It's VERY large and contains multiple file types and multiple directories. I only want those files with "_MP_" in their name, and there are _MP_ files are located within each directory. These tarfiles are located on a server that I can't write to, and because of their size, I don't want to copy the whole tarfile.tar to my machine, I only want the _MP_ files on my machine. Fortunaetly the _MP_ files names are unique so they won't write over themselves when extracting I tried Code:
tar -xvf tarfile.tar --wildcards '*_MP_*' /home/tabitha/my_data/ can someone tell me shat I did wrong? Thanks so much! Tabby |
I can't find the usage of wildcards in the tar man page---I wonder if the string should be in double-quotes?
The first thing I would do is run some tests on a smaller archive to make sure the syntax is right. Quote:
|
Before extracting the tar, you should check content of the tarfile using:-
Code:
tar -tvf tarfile.tar |
According to tar man: --wildcards
use wildcards with --exclude If you want just to match the pattern of retrieved files use such as following (I just used it in my system): tar xvf ../x.tar *00002457170* It restored only the files matching above pattern |
pixellany - "VERY large" means that some of the tarballs are as large as 300+ Gigabytes
shivaa - when I use the tvf option I can see all the files and folders and subfolders inside the tarball. A typical file name of a file that I would want would be: dp1_MP_xx_2012_10_30_00_BIAS.bff The other files would have the same names except the MP would be replaced by FK or DM or EM etc... I found I can use Code:
tar xvf tarball.tar dp1_MP_xx_2012_10_30_00_BIAS.bff THE OTHER PROBLEM IN THIS: Code:
These tarfiles are located on a server that I can't write to, and because they can be 300+ gigabytes in size, I don't want to copy the whole tarball to my machine. |
Can you NFS mount the file system from your remote computer?
|
No, it's not my network
There must be a simple tar command that says, instead of extracting the files in the tarball to the directory it is located in, extract them to some user designated path |
You need to google tar extract over ssh.
Also, see the comment by Carlos here http://www.cyberciti.biz/faq/howto-u...r-ssh-session/, which seems to mesh with Quote:
Seems to agree with Carlos ie if you don't specify that flag, it will go to the other box to get the tar archive, instead of having to explicitly call ssh. |
might sound crazy, but i would suggest for simplicity that you make your own machine ssh accessible, then run your tar command on the remote server in a manner similar to the tutorial linked above.
i.e. (while SSH'd into remote server) Code:
tar xvf tarball.tar *_MP* | ssh user@home_pc "dd of=smallertarball.tar" |
so it turns out that my machine is NFS mounted, not sure what that really means, but maybe that will help???
what if the tarball was somewhere on my machine in say a tmp folder and I wanted to untar it in /home/tabitha/my_data/ couldn't I just do something like: tar xvf tarball.tar > /home/tabitha/my_data/ and I know that's not right and won't work, but it just seems like there should be a simple way to redirect the output of the tar extract command. |
Are you looking for the -C option? (that's a capital 'c')
Quote:
|
Segi - that's it, thanks! I new it had to be an easy thing
|
didn't know that was there, but it makes sense that it would be.
man pages are your friends. |
All times are GMT -5. The time now is 03:00 PM. |