Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then 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.
I have an tarball having following formats of files compressed, e.g.;
Group_A
package-01
package-02
package-03
etc.
Group_B
file-01.patch
file-02.patch
file-03.patch
etc.
What combination of flags have to be up so that files in Group_A will be directed to a new sub_directory_A and files in Group_B to another new sub_directory_B respectively. Both new sub_directories have to be created in executing tar command.
So you're saying that you have 2 groups of files in the root directory of a tar archive and you'd like them to be seperated into directories when you extract the archive?
Sorry I overlooded and forgot to mention in my first posting that there are 3 gourps of files in the tarball, .patch files, packages and read files. I'm trying to mv all .patch files to ~/patches/ and the remaining files to ~/packages/ during extraction.
With '-C' flag all files extracted can be directed to a directory pre-created. However I'm trying to discover whether there are some other flags which can help sorting files during extraction other than using a command line.
You could use 3 seperate tar commands, when you tell tar to extract files you can give it a wildcard to have it only extract certain files. So you could script the directory creation and tar invocation.
Why not just run the 3 tar commands seperately? It's a script, you only have to type it out once and doing it your way is just complicating things for no reason so if you ever have to go back and change it you'll be scratching your head wondering wtf you were trying to o.
Why not just run the 3 tar commands seperately?....
I'm trying to learn something new to me as well as the options of 'tar' command. In fact it is quite simple to do it, just extracting the tarball and moving the files around in "Konqueror/home".
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.