grep inside the zip file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting grep inside the zip file
# 1  
Old 07-28-2008
grep inside the zip file

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
# 2  
Old 07-28-2008
Code:
zgrep 'meter number' file*.zip

# 3  
Old 07-28-2008
hi ali560045

try with gzcat or zcat.

bye
# 4  
Old 07-28-2008
ok, thanks what if i need to grep *.gz files do i have to use the same command?
# 5  
Old 07-28-2008
hi ali560045

you'll find further infos in:

$> man gzcat
# 6  
Old 07-28-2008
Another excellent tool to use is zless.
You are able to less compressed files without going through the rigmarole uncompressing & decompressing files
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Grep a pattern from zip file which has multiple files insdie

Hi Gurus, I got a small requirement in my script to grep a specific pattern in a zip compressed file which has been created with multiple files. Sample File: 20180913.zip $> zipinfo -l 20180913.zip 20180913_file1 20180913_file2 20180913_file3 20180912_file4 20180912_file5... (1 Reply)
Discussion started by: hi.villinda
1 Replies

2. Shell Programming and Scripting

Work with file inside zip

Hi all, I`m trying to find 3 files from all zip files in a directory (and its all its subdirectories) recursively, and concatenate them correspondingly along with the filename (possibly path of that file from current directory). Suppose I have 3 zips a123.zip a234.zip a456.zip ... (2 Replies)
Discussion started by: senhia83
2 Replies

3. Shell Programming and Scripting

Grep on zip file problem

Hi All, I'm stuck with this issue when I try to display the searched string into a compressed file. More exactly when I run this script for f1 in $(find dir1 -type f -print); do gunzip -c $f1 | grep -n "gio" | awk -F":" '{print $1-1 "," $1 "p"}' | xargs -i sed -n {} $f1 ; done returns... (3 Replies)
Discussion started by: gio1234
3 Replies

4. Shell Programming and Scripting

Rename files that are inside zip file

Hello to all, I have a zip file with any name like FileName.zip, within the zip file there are more than 30 files with different extensions in the following format. FileName_BMN_ROSJ.txt FileName_THEUS.jpg . . . FileName_KWPWP.shx I would like to unzip the file and rename each file... (2 Replies)
Discussion started by: Ophiuchus
2 Replies

5. UNIX for Advanced & Expert Users

Zip file inside Zip file(s)

I've a zip file called Z00.zip and in that file there are 22 more zip files. Each zip file having .txt files nearly 10,000 files. I am trying to unzip all these .txt files in one command line to unzip each .zip file from Z00.zip file. Would like to know whether possible to unzip all sub-zip files... (1 Reply)
Discussion started by: nvkuriseti
1 Replies

6. Shell Programming and Scripting

How to grep the contents inside a tar file

Hi All I have searched the possibility of this options everywhere but am unable to find it in any forum. I have a tar file inside which there are n number of files and i dont know them. I need to grep a word inside the tar file and need to know in which file the word resides. > cat a... (2 Replies)
Discussion started by: Whiteboard
2 Replies

7. UNIX for Advanced & Expert Users

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... (3 Replies)
Discussion started by: mayshy
3 Replies

8. Shell Programming and Scripting

doing grep inside perl file

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)
Discussion started by: bp_vardhaman
5 Replies

9. UNIX for Dummies Questions & Answers

how to get the output of a grep command to a file inside a shell script

hi, i wat to get the output of a grep command in a file. but when i am trying out the same grep command in the unix prompt its working fine.. i am getting the output properly.. but when i am writing the same command inside my shell script , its just creating a new output file with no contents... (1 Reply)
Discussion started by: kripssmart
1 Replies

10. UNIX for Dummies Questions & Answers

grep throught Zip file.

Hi, There are serveral files available in a folder. 1. Is there any way I get the list of zip files which contain abc.txt 2. Is ther any way, I get the list of zip file which contain a file which inturn content like "First line of file" There are lot of huge zip files. Kind Reards Deepak (1 Reply)
Discussion started by: deepakwins
1 Replies
Login or Register to Ask a Question