Sponsored Content
Full Discussion: Help with Tar command needed
Top Forums UNIX for Dummies Questions & Answers Help with Tar command needed Post 302943699 by ded325 on Tuesday 12th of May 2015 04:45:53 AM
Old 05-12-2015
Help with Tar command needed

Lets say I have 100 files. in those files I need to search specific word and I want to tar all those files at once. how can I do that?
Code:
tar -cvf test.tar |grep house *.*

Will it work?



Moderator's Comments:
Mod Comment
Please wrap all code, files, input & output/errors in CODE tags.
It makes them easier to read and preserves multiple spaces, which is very important for fixed width data and code indenting.

Last edited by rbatte1; 05-12-2015 at 08:37 AM.. Reason: Added CODE tags, corrected spelling, punctuation and capital letters
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Tar Command

Suppose that you have to restore a file from a TAR and put it in a different directory. To be more clear, suppose that you have a TAR file (backup of 3 files) : tar -tvf TARfile /data1/file1 /data2/data/file2 /data3/file3 You need to restore file2 to /tmp/file2.tmp ? Is it possible ? if... (1 Reply)
Discussion started by: sof
1 Replies

2. Solaris

tar - help needed

I need to retrieve one file from tape which appears to be dumped to using tar. I have tried the following command - but no luck. Any ideas? I dont want to to restore the complete backup - just one file. tar -xf /dev/rmt/0cn /var/opt/tmp/AA/dump/TEST.DUMP_20051003 Backup script looks... (6 Replies)
Discussion started by: frustrated1
6 Replies

3. UNIX for Dummies Questions & Answers

Need help with tar command

Can anyone help me to staff three files with tar command and then unstaff them Thx in advance for any help. (2 Replies)
Discussion started by: Geldy
2 Replies

4. Shell Programming and Scripting

Tar command

I want to tar multiple folder from a environment but exclude 2 folders among them. How can I do that. Is there any exclude option in tar command. Please co-operate me. Thanking you, Chandrakant. (8 Replies)
Discussion started by: get_chandrakant
8 Replies

5. 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

6. Shell Programming and Scripting

tar command dont tar to original directory

HI, if I have a tarfile called pmapdata.tar that contains tar -tvf pmapdata.tar -rw-r--r-- 0/0 21 Oct 15 11:00 2009 /var/tmp/pmapdata/pmap4628.txt -rw-r--r-- 0/0 21 Oct 14 20:00 2009 /var/tmp/pmapdata/pmap23752.txt -rw-r--r-- 0/0 1625 Oct 13 20:00 2009... (1 Reply)
Discussion started by: borderblaster
1 Replies

7. 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

8. Shell Programming and Scripting

Single command - unzip files from a tar command

I have a tar file that contains multiple .Z files. Hence I need to issue a tar command followed by a gzip command to fully extract the files. How do I do it in a single command? What I'm doing now is tar xvf a.tar (this will output 1.Z and 2.Z) gzip -d *.Z (to extract 1.Z and 2.Z) (9 Replies)
Discussion started by: ericlim
9 Replies

9. UNIX for Dummies Questions & Answers

Tar Command Help

Is it possible to untar a file so it's size reduces while it uncompresses its contents. I have limited space on my mount point and was wondering if we can untar as a stream in other words the size of tarball reduces as it uncompresses the contents. Thanks (5 Replies)
Discussion started by: sumang24
5 Replies

10. 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
ZGREP(1)						      General Commands Manual							  ZGREP(1)

NAME
zgrep - search possibly compressed files for a regular expression SYNOPSIS
zgrep [ grep_options ] [ -e ] pattern filename... DESCRIPTION
Zgrep invokes grep on compressed or gzipped files. These grep options will cause zgrep to terminate with an error code: (-[drRzZ]|--di*|--exc*|--inc*|--rec*|--nu*). All other options specified are passed directly to grep. If no file is specified, then the standard input is decompressed if necessary and fed to grep. Otherwise the given files are uncompressed if necessary and fed to grep. If the GREP environment variable is set, zgrep uses it as the grep program to be invoked. EXIT CODE
2 - An option that is not supported was specified. AUTHOR
Charles Levert (charles@comm.polymtl.ca) SEE ALSO
grep(1), gzexe(1), gzip(1), zdiff(1), zforce(1), zmore(1), znew(1) ZGREP(1)
All times are GMT -4. The time now is 12:44 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy