how to grep/read a file inside compressed tgz without extract?
Hi all,
I would like to ask whether in Unix shell/perl have any functions or command to allow grep/cat/read a file inside compressed .tgz without extract it?
I know we can tar tvf a compressed tgz but this only allow we read the path/filename contained inside the tarball. If we want to read the file, does it possible?
Let said I have a compressed file: test.tgz
It contains:
Can we grep files which contains "d" inside the compressed test.tgz without extract test.tgz? (some function like gzcat can read compressed file)
Thanks for any input!
Last edited by radoulov; 03-08-2010 at 06:43 AM..
Reason: Please use code tags!
i have to grep a particular pattern say "meter number" in 100s of zip files
file1.zip
:
:
:
:
file100.zip
how to achive this?
cat *.zip | grep "meter number"
also i dnt want to unzip and then grep it......
hope i made myself clear. thanks in advance (5 Replies)
Let's say I've got File.tgz that contains:-
Apple.txt
Banana.txt
Carrot.txt
AppleBanana.txt
Now, I would like to only extract files that contain the patter "Apple".
I've tried this
tar -xvf File.tgz 'tar -tf File.tgz | grep 'Apple''
but it does not work. Please help. Thanks. (12 Replies)
Hi have one Perl file inside that i am defining
at an array file.
@temp_vmdk_files = `grep vmdk '$guest_vmx'`
where my $guest_vmx=/vmfs/volumes/47e40fec-9c8bb7f7-d076-001422159f8a/BES Exchange/BES-Exchange.vmx
and i am just want to do grep of "vmdk" files from the above path
but when... (5 Replies)
All,
The bottom line is that im reading a file, storing it as variables, recursively grep searching it, and then piping it to allow word counts as well. I am unsure on how to open any .zip .tar and .gzip, search for keywords and return results.
Any help would be much appreciated!
Thanks (6 Replies)
Hi Gurus,
I am working with a korn shell script to simplify some operations of calculation number of lines inside compressed file.
The called function (inside a cycle) is the following:
#########################################
# F.ne: CheckCount
#########################################... (3 Replies)
This is for Red Hat Enterprise Linux Client release 5.7 (Tikanga).
Wanna extract entire contents of a tar.gz to a folder of my choosing. Thanks (2 Replies)
Hi,
I am reading file records inside a while loop,
and want to update the record when certain condition is met.
How can I update a file while being read?
I want to avoid using temporary files, copy, rename, ...
while IFS=',' read -r f1 f2
do
function(f1,f2)
if
then
<add... (1 Reply)
Hi Experts,
Need your guidance for case statement. I tried many way but no success yet.Now my existing code is doing something like below. Each Line of the input file contains one test case.#!/bin/bash
FILE=$1
while read LINE; do
do COMMAND
done < $FILE
Now I want to modify the code... (6 Replies)
Discussion started by: pradyumnajpn10
6 Replies
LEARN ABOUT PLAN9
zgrep
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)