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
I need to grep a country Mexico in all these files in the zip and print the content. Can someone provide any relevant article or exact way to accomplish it please?
Thanks in Advance.
Venkat
Last edited by Scott; 09-13-2018 at 05:08 PM..
Reason: Please use real CODE tags, not {code}!
If the archive isn't compressed, just using:
might give you the lines you want in all of the files in the archive.
If the archive is compressed or if you need to know which files in the archive contain matching lines, the typical way to do so it to create a new directory, unzip the files in the archive into that directory, move into that directory, and then run:
Some versions of zip/unzip may have options to do what you want without unziping the archive. Since you haven't given us any indication of what operating system you're using, we can't make any guess at whether or not your implementation might have such an option.
Hi All,
OS: Redhat Linux 7.5
Shell: Bash
I have some folder like this
2018-09-16
2018-09-17
2018-09-18
2018-09-19 and so on...
Everyday one script create a folder with pattern YYYY-MM-DD (it will have so many sub directories files in it)
Now what I would like to achieve is a... (1 Reply)
Hi all i am very new to shell scripting and need some help from you to learn
1)i have some log files that gets generated on daily basis example: i have abc_2017_01_30_1.log ,2017_01_30_2.log like wise so i want to zip this 4 logs which are created on same date into one zip folder.
2)Post zipping... (1 Reply)
Hi all i am very new to shell scripting and need some help from you to learn
1)i have some log files that gets generated on daily basis example: i have abc_2017_01_30_1.log ,2017_01_30_2.log like wise so i want to zip this 4 logs which are created on same date into one zip folder.
2)Post zipping... (2 Replies)
Hi ,
I am having a ZIP file containing an .xlsx file . Now i wanted to replace "GJ" to blank in the .xlsx file .
I tried using the below code but not working , Please guide :
#!/bin/bash
log="/home/srikant/scripts/replacescriptFHO.log"
date > $log
echo "" >> $log
echo initiating for FHO... (1 Reply)
Hi
I have a requirement in unix shell where I need to zip multiple files on server to one single .zip file. I dont see zip command in AIX and gzip command not doing completely what I want.
One I do .zip file, I should be able to unzip in my local Computer.
Here is example what I want... (9 Replies)
Hello All,
I have a file which is having below type of data,
Jul 19 2011 | 123456
Jul 19 2011 | 123456
Jul 20 2011 | 123456
Jul 20 2011 | 123456
Here I wanted to grep for date pattern as below, so that it should only grep "Jul 20" OR "Jul ... (9 Replies)
Hi,
I want to find all directories matching given pattern in current directory and zip those files.
I am trying to do somethign like this. But it is not working.
for FNAME in $(find . -type d | grep './\{2\}-\{2\}$');
do
zip -r MatchedFiles.zip $FNAME
rm -fr $FNAME
done
... (4 Replies)
Hi Everyone
pls if anyone can help me in writing a script or correcting it what I have done.
I want to write a script to grep record number for all those record which have abc xyd cat dog in one of the field say VALUE, I have thousand of file in a dir and I want to search every file for... (6 Replies)
I have to zip many pdf files and the size of zip file must not exceed 200 MB. When size is more than 200 MB then multiple zip files needs to be created.
How we can achieve this in UNIX?
I have tried ZIP utility but it takes a lot of time when we add individual pdfs by looping through a... (1 Reply)
Hello,
I am trying to return the name of the resulting file from a .zip archive file using unix unzip command.
unzip c07212007.cef7081.zip
Archive: c07212007.cef7081.zip
SecureZIP for z/OS by PKWARE
inflating: CEP/CEM7080/PPVBILL/PASS/G0063V00
I used the following command to unzip in... (5 Replies)