LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-03-2012, 02:12 AM   #1
deepa.y
LQ Newbie
 
Registered: May 2012
Posts: 1

Rep: Reputation: Disabled
extract files from tar file containing sub directories .


Hi,
I need to extract files out from a tar file containing subdirectories in to another directory.
if my tar file is mytar.tar in path /tmp/usr/mytar.tar and mytar.tar contains sub directories
m1,m2,m3 containing two files each.
i need to extract all the 6 files into
/tmp without subdirectory structure.
Please let me know how can i achieve this using pax command.
 
Old 05-03-2012, 07:37 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 22,217

Rep: Reputation: 5962Reputation: 5962Reputation: 5962Reputation: 5962Reputation: 5962Reputation: 5962Reputation: 5962Reputation: 5962Reputation: 5962Reputation: 5962Reputation: 5962
Quote:
Originally Posted by deepa.y View Post
Hi,
I need to extract files out from a tar file containing subdirectories in to another directory. if my tar file is mytar.tar in path /tmp/usr/mytar.tar and mytar.tar contains sub directories m1,m2,m3 containing two files each. i need to extract all the 6 files into /tmp without subdirectory structure.
Please let me know how can i achieve this using pax command.
You can start by reading the man page on the pax command and/or the tar command. Reading the documentation is always a good step-one.
Code:
pax -v -r -s '/.*\///p'
 
Old 05-03-2012, 07:45 PM   #3
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,458

Rep: Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602
sounds and smells like homework
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
wants to extract the tar.gz files rajini23 Linux - Desktop 8 02-09-2012 12:32 PM
[SOLVED] command for tar'ing multiple sub-directories into a single tar file blainemiller Linux - Server 3 04-21-2011 03:05 PM
Extract .tar.bz2 files cahardin76 Linux - Newbie 3 11-13-2010 11:35 PM
extract tar.gz file in other directories shifter Linux - Newbie 4 06-15-2010 05:09 AM
How can I extract only *.c files from a tar.gz? [KIA]aze Linux - Newbie 7 06-06-2007 05:39 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:58 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration