11-02-2017
Quote:
Originally Posted by
jimmyjames9
It seems that you can't read the content without extracting...
Literally true, even with tools like zgrep. What zgrep actually does is
gunzip < inputfile | grep ... so decompression is not skipped, it just avoids making a temp file. And it's definitely not meant for tar files.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
If a zip file contains several zip files, but if the file names of the files needed are known, is there a variation of the unzip command that will allow those few (individual) files to be extracted?
---
Example:
Zip file name: zip.zip
unzip -l zip.zip will display file01, file02, file03, etc.... (1 Reply)
Discussion started by: HLee1981
1 Replies
2. Shell Programming and Scripting
so i have hundreds of files named history.20071112.tar
(history.YYYYMMDD.tar)
and im looking to extract one file out of each archive called status_YYYYMMDDHH:MM.lis
here is what i have so far:
for FILE in `cat dirlist`
do
tar xvf $FILE ./status_*
done
dirlist is a text... (4 Replies)
Discussion started by: kuliksco
4 Replies
3. Shell Programming and Scripting
Hi All,
I would like to extract specific file from a zip archive.
I have a zip archive "sample.zip".
sample.zip contains few text files and images... text1.txt, text2.txt, pic.jpg etc...
I need to read specific file "text2.txt" from "sample.zip" WITHOUT EXTRACTING the zip file.
... (4 Replies)
Discussion started by: sridharg
4 Replies
4. Shell Programming and Scripting
Hi All,
I want to read the content of the particular file from tar.Z without extracting.
aaa.tar.Z contains a file called one.txt, I want to read the content of the one.txt without extracting.
Please help me to read the content of it.
Regards,
Kalai. (12 Replies)
Discussion started by: kalpeer
12 Replies
5. Shell Programming and Scripting
Hey guys complete n00b here so I'll try my best at explaining.
I'm creating a backup and restore utility and decided to use tar. I create a backup folder in each user's account and when backing up (say word processing files), I use the following:
tar cvf /home/user/backup/wpbackup.tar... (2 Replies)
Discussion started by: EwanD
2 Replies
6. UNIX for Dummies Questions & Answers
I have tried:
tar -xfv mytarfile.tar archive/tabv/*
tar -xfv mytarfile.tar --wildcards 'archive/tabv/*'
tar -xf mytarfile.tar -v --wildcards 'archive/tabv/*'
tar -xfv mytarfile.tar --wildcards --no-anchored 'archive/tabv/*'
tar -xfv mytarfile.tar --wildcards `archive/tabv/*`
and none... (5 Replies)
Discussion started by: zapper222
5 Replies
7. UNIX for Advanced & Expert Users
Is anyone out there? I'm trying to run a script i wrote that extracts multiple .tar files in succession by pasting it into standard input. It does extract them all but I cant get it to stop looping and when I hit enter I get a tar command error like its still looking for files to extract.
ie;
... (2 Replies)
Discussion started by: commoja
2 Replies
8. Shell Programming and Scripting
Hi All,
I have the file in this format
**** Results Data ****
Time or Step
1
2
20
0.000000000e+00 0s 0s 0s
1.024000000e+00 Us 0s 0s
1.100000000e+00 1s 0s 0s
1.100000001e+00 1s 0s 1s
2.024000000e+00 Us Us 1s
2.024000001e+00 ... (7 Replies)
Discussion started by: diehard
7 Replies
9. Red Hat
Hello,
Please help me with this!! Thanks in advance!!
I have a file named file.gc with the content:
1-- Mon Sep 10 08:53:09 CDT 2012
2revoke connect from FR2261;
3delete from mkt_allow where grantee = 'FR2261';
4grant connect to FR2261 with '******';
5alter user FR2261 comment... (0 Replies)
Discussion started by: raosr020
0 Replies
10. Shell Programming and Scripting
Why does not work a cd in a shell schript file.
How do you get to run it?
I use these code:
#!/bin/sh
cd workspace
array=($(ls -d */))
echo ${array}
But it doesn't change to workspace
editby bakunin: please user CODE-tags as required by the rules. Thank you. (12 Replies)
Discussion started by: Linuxmann
12 Replies
tar(n) Tar file handling tar(n)
__________________________________________________________________________________________________________________________________________________
NAME
tar - Tar file creation, extraction & manipulation
SYNOPSIS
package require Tcl 8.4
package require tar ?0.4?
::tar::contents tarball
::tar::stat tarball ?file?
::tar::untar tarball args
::tar::get tarball fileName
::tar::create tarball files args
::tar::add tarball files args
::tar::remove tarball files
_________________________________________________________________
DESCRIPTION
::tar::contents tarball
Returns a list of the files contained in tarball. The order is not sorted and depends on the order files were stored in the archive.
::tar::stat tarball ?file?
Returns a nested dict containing information on the named ?file? in tarball, or all files if none is specified. The top level are
pairs of filename and info. The info is a dict with the keys "mode uid gid size mtime type linkname uname gname devmajor devminor
% ::tar::stat tarball.tar
foo.jpg {mode 0644 uid 1000 gid 0 size 7580 mtime 811903867 type file linkname {} uname user gname wheel devmajor 0 devminor 0}
::tar::untar tarball args
Extracts tarball. -file and -glob limit the extraction to files which exactly match or pattern match the given argument. No error is
thrown if no files match. Returns a list of filenames extracted and the file size. The size will be null for non regular files.
Leading path seperators are stripped so paths will always be relative.
-dir dirName
Directory to extract to. Uses pwd if none is specified
-file fileName
Only extract the file with this name. The name is matched against the complete path stored in the archive including directo-
ries.
-glob pattern
Only extract files patching this glob style pattern. The pattern is matched against the complete path stored in the archive.
-nooverwrite
Dont overwrite files that already exist
-nomtime
Leave the file modification time as the current time instead of setting it to the value in the archive.
-noperms
In Unix, leave the file permissions as the current umask instead of setting them to the values in the archive.
% foreach {file size} [::tar::untar tarball.tar -glob *.jpg] {
puts "Extracted $file ($size bytes)"
}
::tar::get tarball fileName
Returns the contents of fileName from the tarball
% set readme [::tar::get tarball.tar doc/README] {
% puts $readme
}
::tar::create tarball files args
Creates a new tar file containing the files. files must be specified as a single argument which is a proper list of filenames.
-dereference
Normally create will store links as an actual link pointing at a file that may or may not exist in the archive. Specifying
this option will cause the actual file point to by the link to be stored instead.
% ::tar::create new.tar [glob -nocomplain file*]
% ::tar::contents new.tar
file1 file2 file3
::tar::add tarball files args
Appends files to the end of the existing tarball. files must be specified as a single argument which is a proper list of filenames.
-dereference
Normally add will store links as an actual link pointing at a file that may or may not exist in the archive. Specifying this
option will cause the actual file point to by the link to be stored instead.
::tar::remove tarball files
Removes files from the tarball. No error will result if the file does not exist in the tarball. Directory write permission and free
disk space equivalent to at least the size of the tarball will be needed.
% ::tar::remove new.tar {file2 file3}
% ::tar::contents new.tar
file3
BUGS, IDEAS, FEEDBACK
This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category tar of
the Tcllib SF Trackers [http://sourceforge.net/tracker/?group_id=12883]. Please also report any ideas for enhancements you may have for
either package and/or documentation.
KEYWORDS
archive, tape archive, tar
tar 0.4 tar(n)