LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 01-31-2012, 04:56 AM   #1
zx_
LQ Newbie
 
Registered: Sep 2011
Posts: 23

Rep: Reputation: Disabled
Extract from `tar` archive as ordered in --files-from


Following command:

Code:
tar -xzf archive.tar.gz -T 'mylist.txt'
does not extract files from "archive.tar.gz" as ordered in 'mylist.txt', but as in order they are compressed.

How can I tell `tar` to extract files as ordered in 'mylist.txt'

Last edited by zx_; 02-04-2012 at 09:09 AM.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 01-31-2012, 06:26 AM   #2
abohmeed
LQ Newbie
 
Registered: Mar 2011
Posts: 21

Rep: Reputation: 3
What do you mean by "order" ?
From tar man page:
-T, --files-from F: get names to extract or create from file F
basically, it extracts only files whose names are found in the specified file.
 
Old 01-31-2012, 08:18 AM   #3
zx_
LQ Newbie
 
Registered: Sep 2011
Posts: 23

Original Poster
Rep: Reputation: Disabled
I mean files in archive are compressed like:

...
3.txt
1.txt
2.txt


and I have file list (mylist.txt):

1.txt
2.txt
3.txt
...

And want to extract them in that order, not in order as they are compressed

I (noob) was surprised that files aren't extracted in order as they are read from pointed filelist (mylist.txt)

Last edited by zx_; 01-31-2012 at 08:20 AM.
 
Old 01-31-2012, 10:15 AM   #4
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
Why does the order matter, and how can you even tell what order they were extracted in?
 
Old 01-31-2012, 08:44 PM   #5
zx_
LQ Newbie
 
Registered: Sep 2011
Posts: 23

Original Poster
Rep: Reputation: Disabled
If it doesn't matter I wouldn't have asked, but instead answering on more questions while I expected answer to what it seems to me clear question, I'll just thank you for your time.

Cheers

Last edited by zx_; 01-31-2012 at 08:45 PM.
 
Old 02-01-2012, 02:28 PM   #6
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,784

Rep: Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214
A tar archive is a linear stream with no overall index. The only way to locate a file is to read the archive from the beginning. It was originally written to work with tape drives (the name comes from "Tape ARchiver"), where seeks are expensive, and is also frequently used in pipelines, where seeks are impossible. It will always list or extract files in the order they appear in the archive.
 
2 members found this post helpful.
Old 02-04-2012, 09:08 AM   #7
zx_
LQ Newbie
 
Registered: Sep 2011
Posts: 23

Original Poster
Rep: Reputation: Disabled
Thanks. Your reply cleared my question
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Extract each file from TAR archive separately zx_ Linux - Newbie 7 01-29-2012 04:53 PM
[SOLVED] tar fails to extract archive containing special characters shadowbox12 Linux - General 2 09-14-2011 06:05 AM
adding files to tar archive pooks Linux - Newbie 3 04-02-2009 06:08 AM
How to extract too large archive (35 GB) .tar file Bharat Kumar pankaj Linux - Server 10 08-19-2008 07:35 AM
tar won't extract a big archive & won't explain... wghay Linux - Software 4 03-05-2006 11:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration