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.
I think i've tried zgrep in the past, but I can't remember why i didn't use it. I just tried it with my script, but it returns a message saying that it doesn't recognize my options. The message reads: "/usr/bin/zgrep: -iro: option not supported" and "/usr/bin/zgrep: -iroln: option not supported". I tried separating them out (e.g. -i -r -o) and it only returned a message saying the "-r" option was invalid. Does zgrep search recursively?
On Linux it's a shell script, so you may try to tweak it, if you wish (not sure what you mean by recursively here).
May be if you try to describe your task giving more details and examples, helping you would be easier.
here is a copy of my script
The script is meant to take in a file containing a list of words, recursively search through a directory excluding hidden files, and finally printing results of the words found, as well as where it was found.
Thanks for your help so far!
p.s. I am new to posting on forums and therefore might have messed up the table containing my script
---------- Post updated at 11:07 AM ---------- Previous update was at 10:52 AM ----------
Im sorry, i posted the wrong script. The most current one is bassically the same. Instead of using zgrep, I used grep, and i havent added the --exclude string.
---------- Post updated at 11:12 AM ---------- Previous update was at 11:07 AM ----------
and also, when I mentioned recursively I intended to have it search from a directory down, through all the subdirectories and files.
Last edited by radoulov; 07-09-2010 at 11:53 AM..
Reason: Fixed code tags!
I have a environment property file which contains:
Input file:
value1 = url1
value2 = url2
value3 = url3 and so on.
I need to search all *.xml files under directory for value1 and replace it with url1.
Same thing I have to do for all values mentioned in input file. I need script in unix bash... (7 Replies)
I have many compressed files I want to search using awk and want to print some file contents along with the filename it came from on each output record (I simplified awk command).
Here are the results with the files uncompressed:
awk '{print FILENAME, $0}' test*.txt
test1.txt from test1... (3 Replies)
I am trying to read a file line by line and then search that line in another file and get a particular column from the second file.
I have written this code.but its not working properly
#!/bin/sh
while read keyword in duplicate.txt
do
echo $keyword
while read line
do
... (7 Replies)
I was following this tutorial on How install the rpmfusion nvidia drivers in Fedora 13:
F13, F12 & F11 Nvidia driver guides - FedoraForum.org
Here's the tutorial:
And this is what I did:
First I executed the following commands:
su
rpm -Uvh ... (0 Replies)
Hi,
I have a folder which contains multiple config.xml files and one input file, Please see the below format.
Config Files format looks like :-
Code:
<application name="SAMPLE-ARCHIVE">
<NVPairs name="Global Variables">
<NameValuePair>
... (0 Replies)
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)
Hi,
At my company, we have custom web sites that we create for different clients. The folder structure is something like:
<project name>/html/web/custom/
The custom folder contains a file called "category.html"
Every project has the same folder structure, and same file names but, the data... (2 Replies)
After pouring over my LTKS and Unix in a nutshell, I'm stuck!
I have a large (BMC Report File) that has breaks on DM (district managers).
After a report header, there is a DM header like:
DM: DBP AARON ROBERTS
At the end of each DM break, there is:
** END OF REPORT **
... (6 Replies)
I was wondering if there's a way to search within a file that's been compressed. i.e. if file a is inside file a.zip or a.gz, is there a a command that will retrieve the string of data I'm looking for in file a, and list which compressed file it found it in?
Please help!
Thanks. (8 Replies)
I want to read a directory full of compressed files and move the file to another directory if it meets certain criteria. I only want to look at the first line of the compressed file and if I find the string, do the move. I am currently using the following:
zgrep -R -L... (1 Reply)