Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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/
but I get errors of "Not found in archive" and I know they are in there
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
tar xvf tarball.tar *_MP_*
tar xvf tarball.tar *dp1_MP_xx*.bff
the last command seems to work for all the MP files in the tarball no matter what folder or sub folder they are in - YEA
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.
So how do I redirect the tar extracting command to output only the MP files to /home/tabitha/my_data/
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
--force-local
archive file is local even if it has a colon
http://linux.die.net/man/1/tar
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"
maybe that won't work, but it's an idea - and, I think, probably easier than figuring this out some other way.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.