01-05-2011
The command
tar -tvf one.tar will only list the contents of the archive, not the contents of the contents?
Sorry. Not the best phrasing there.
It's like a library having a list of the books on the shelves that you can scan through, but it won't be able to find the phrases of text actually in the books themselves.
If you need to have critical things accessible in this way, you may need to create yourself some sort of a reference index for the critical entries. Otherwise, you would need to extract the files back to disk and then run the
grep on the files before tidying them away, but there usually isn't space to do that and there is a lot of I/O to do too.
I supppose it might be possible to stream through the tar file looking for the file markers and the string you are searchign for, but that would surely be C code written and you would have to understand the tar file structure - which I don't.
Robin
Liverpool/Blackburn
UK
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
I am receving a file from remote site which has EDI information for 830, 862 and 997 and I want to extect the data for 997 using grep's or any other methods.
The data look like this:
ISA~000
0000-0001-1000~997
AK1000~m
000~IEA~M
ISA~000
0000-0001-1000~849
000~IEA~M
ISA~000... (11 Replies)
Discussion started by: isingh786
11 Replies
2. AIX
Hi
I have a file named files.2.backup which holds the location of some directory and file i,e
$ cat files.2.backup
/d01/app/oracle/product/7.3.2/dbs/fortest_syst_01.dbf
/d01/app/oracle/product/7.3.2/dbs/fortest_temp_01.dbf
/d01/app/oracle/product/7.3.2/dbs/fortestdata_01.dbf... (5 Replies)
Discussion started by: sumanbangladesh
5 Replies
3. Shell Programming and Scripting
Hi,
can someone help me.
I have some files and search a content in this files. If i have a hit I will print a output:
filename:content
But are more hits in one file: The output is always filename:content
E.G. Seach about "three"
file1 {one, two, three, four, three}
file2... (5 Replies)
Discussion started by: Timmää
5 Replies
4. Solaris
Hi fellows,
Can you please share any command with which I can list down the file names inside a tar.gz file.
I have tried with these possibilities but in vain.
bash-3.00$ tar -ztvf file.tar.gz
tar: z: unknown function modifier
bash-3.00$ tar ztvf file.tar.gz
tar: z: unknown function... (1 Reply)
Discussion started by: Zaib
1 Replies
5. Shell Programming and Scripting
*****************************************
Right now i have this current system.
I have two files say xxx.txt and yyy.txt. xxx.txt is with list of patterns within double quotes. Eg.
"this is the line1"
"this is the line2"
The yyy.txt with lot of lines. eg:
"This is a test message which... (7 Replies)
Discussion started by: abinash
7 Replies
6. Shell Programming and Scripting
Dear Unix Gurus,
I am new to shell scripting and in the process of learing.
I am trying to find whether a file name has today's date in MMDDYYYY format.
I am using the following code and it doesn't seem like working.
#!/usr/bin/ksh
today=$(date '+%m%d%Y')
echo today: $today
file=`find... (4 Replies)
Discussion started by: shankar1dada
4 Replies
7. Shell Programming and Scripting
Hi All,
Need help on this
I have 2 files
one file file1 which has several entries as :
define service{
hostgroup_name !host1,!host5,!host6,.*
service_description check_nrpe
}
define service{
hostgroup_name !host2,!host4,!host6,.*
service_description check_opt
}
another... (2 Replies)
Discussion started by: namitai
2 Replies
8. Shell Programming and Scripting
Dear all
I need to unzip a file then further it has many folders to perform tak inside each folder.
What Task I need to perform I'm able to do it but once I unzip a folder then I'm not able to do cd folder/ into it. I have written following code for it
for i in $( ls | grep Run_20111016 )
do... (2 Replies)
Discussion started by: Bhalinder
2 Replies
9. Shell Programming and Scripting
Hi,
I would like to ask if there is a way to search for a file inside a .tar.gz file without extracting it? If there is, is there a way to search for that file by date?
Thanks! (4 Replies)
Discussion started by: erin00
4 Replies
10. UNIX for Dummies Questions & Answers
hi,
I'm trying to grep content from one file in another file.
The file that I'm searching into is large and hence I need to temporarily unzip it first.
gzip -dc ALL.chr2.phase3_shapeit2_mvncall_integrated_v5a.20130502.genotypes.vcf.gz | grep '169997024\|190670539\|128051369' >... (2 Replies)
Discussion started by: janshamsani
2 Replies
TAR(1) General Commands Manual TAR(1)
NAME
tar - archiver
SYNOPSIS
tar key [ file ... ]
DESCRIPTION
Tar saves and restores file trees. It is most often used to transport a tree of files from one system to another. The key is a string
that contains at most one function letter plus optional modifiers. Other arguments to the command are names of files or directories to be
dumped or restored. A directory name implies all the contained files and subdirectories (recursively).
The function is one of the following letters:
c Create a new archive with the given files as contents.
x Extract the named files from the archive. If a file is a directory, the directory is extracted recursively. Modes are restored if
possible. If no file argument is given, extract the entire archive. If the archive contains multiple entries for a file, the lat-
est one wins.
t List all occurrences of each file in the archive, or of all files if there are no file arguments.
r The named files are appended to the archive.
The modifiers are:
v (verbose) Print the name of each file treated preceded by the function letter. With t, give more details about the archive entries.
f Use the next argument as the name of the archive instead of the default standard input (for keys x and t) or standard output (for
keys c and r).
u Use the next (numeric) argument as the user id for files in the output archive. This is only useful when moving files to a non-Plan
9 system.
g Use the next (numeric) argument as the group id for files in the output archive.
EXAMPLES
Tar can be used to copy hierarchies thus:
{cd fromdir; tar c .} | {cd todir; tar x}
SOURCE
/sys/src/cmd/tar.c
SEE ALSO
ar(1), bundle(1), tapefs(1)
BUGS
There is no way to ask for any but the last occurrence of a file.
File path names are limited to 100 characters.
The tar format allows specification of links and symbolic links, concepts foreign to Plan 9: they are ignored.
TAR(1)