How to use the command Tar to find a file


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users How to use the command Tar to find a file
# 1  
Old 08-18-2005
How to use the command Tar to find a file

Hello,

I am just using the command Tar to find if a file was backuped on my tape.

Can you help me with that command. I am using the command :
tar -tvf /dev/rmt/4m /kcc_dms/AC7/c15a* > toto.txt to find all files c15a* in these subdirectories on my tape. But it doesn't work correctly.

Can you help me for that problem.

Thanks

Christian
# 2  
Old 08-18-2005
From the tar manual:

Code:
           If a named file matches a directory whose contents has
           been  written to the tarfile, this directory is recur-
           sively extracted. The owner,  modification  time,  and
           mode are restored (if possible); otherwise, to restore
           owner, you must be the  super-user.  Character-special
           and  block-special  devices (created by mknod(1M)) can
           only be extracted by the super-user.  If no file argu-
           ment  is  given,  the entire content of the tarfile is
           extracted. If the tarfile contains several files  with
           the same name, each file is written to the appropriate
           directory, overwriting the previous one. Filename sub-
           stitution  wildcards  cannot  be  used  for extracting
           files from the archive. Rather, use a command  of  the
           form:

     tar xvf ... /dev/rmt/0 `tar tf ... /dev/rmt/0 | \
          grep 'pattern' `


So you need to use something like:

tar -tvf /dev/rmt/4m | grep '/kcc_dms/AC7/c15a' > toto.txt
# 3  
Old 08-18-2005
I think this ll do :

tar -tvf /dev/rmt/4m | grep 'c15a' > toto.txt
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Tar command generation with Find

Hello, I'm trying to generate a TAR command and fill it with the result of a Find command. What I did is not elegant and I'm sure that it can be in a different way to be faster. I need to Find all files with an extension to ".sf". If a file is found, I need to replace the extension ".sf" to... (11 Replies)
Discussion started by: royinfo.alain
11 Replies

2. UNIX for Dummies Questions & Answers

UNIX command to check if file name ends with .tar OR if the file is a tar file

Hello Team, Would you please help me with a UNIX command that would check if file is a tar file. if we dont have that , can you help me with UNIX command that would check if file ends with .tar Thanks in advance. (10 Replies)
Discussion started by: sanjaydubey2006
10 Replies

3. Shell Programming and Scripting

find + tar + gzip + uunecode/email --> in one command?

How to search for all files with matching strings --> find + tar + gzip + uunecode/email them in one command? I am sure there is a right way to pass list of files to tar, then compress tar file. Then send that as attachment using uuencode in one command.. Can we do that!? (3 Replies)
Discussion started by: kchinnam
3 Replies

4. Shell Programming and Scripting

tar command to explore multiple layers of tar and tar.gz files

Hi all, I have a tar file and inside that tar file is a folder with additional tar.gz files. What I want to do is look inside the first tar file and then find the second tar file I'm looking for, look inside that tar.gz file to find a certain directory. I'm encountering issues by trying to... (1 Reply)
Discussion started by: bashnewbee
1 Replies

5. Shell Programming and Scripting

Find all tar and compressed file

Hi, I'm trying to find all tar and compressed files (say gzip). I'm having to assume that the tar and gzip files may or may not have the correct extension (.tar .gz .tgz etc). Any help appreciated (2 Replies)
Discussion started by: andyatit
2 Replies

6. UNIX for Dummies Questions & Answers

find a corrupt tar file

Hey there I am just looking for a way to find a corrupt tar file. I want to write a script to help sift through the 1000's of tar files we go through daily and move any corrupt ones to a different directory structure. Is there an easy way to do this. (4 Replies)
Discussion started by: car2nst2006
4 Replies

7. UNIX for Dummies Questions & Answers

tar -cvf test.tar `find . -mtime -1 -type f` only tar 1 file

Hi all, 4 files are returned when i issue 'find . -mtime -1 -type f -ls'. ./ora_475244.aud ./ora_671958.aud ./ora_934052.aud ./ora_934050.aud However, when I issued the below command: tar -cvf test.tar `find . -mtime -1 -type f`, the tar file only contains the 1st file -... (2 Replies)
Discussion started by: ahSher
2 Replies

8. Solaris

Find files older than x days and create a consolidated single tar file.

Hello, I need help in finding files older than x days and creating a single consolidated tar file combining them. Can anyone please provide me a script? Thanks, Dawn (3 Replies)
Discussion started by: Dawn Bosch
3 Replies

9. AIX

command usage on find with xargs and tar

my task : tar up large bunch of files(about 10,000 files) in the current directories that created more than 30 days ago but it come with following error find ./ -ctime +30 | xargs tar rvf test1.tar tar: test1.tar: A file or directory in the path name does not exist. (3 Replies)
Discussion started by: darkrainbow
3 Replies

10. Shell Programming and Scripting

find multiple file types and tar

There are these ksh files and config files that are written and updated on a daily basis. All I want to do is write a script that finds both these types of files and archive them on a daily basis, to help in restoring in times of system outages and so on. Particulary I'm interested in .ksh ,... (9 Replies)
Discussion started by: manthasirisha
9 Replies
Login or Register to Ask a Question