I wanted to do something like this :
Go through all the top_level_dirs inside a particular dir.
Grep a particular string in the files in each of those dirs.
Count the occurence of that string in that file
Keep adding these (wc) values so that I can know the total occurences of that string throughout the dirs of that dir.
eg .
I have dir a. and dir b and c are subdirs to a.
Now there is a file 1.log in b/1.log and c/1.log
I want to grep "Hi" in each of them and display the total occurrences.
Please note, I am trying to do this on Command line and not in a script. Also the dir contents and the log files are astronomical so a "grep -r" is ruled out. Wanted something like,
Somebody can please give a highlight on this. The problem shows only on Linux(Redhat) not any other unix flavors
:confused:
Linux :
$unset m
$m=`find . -newer rman_padev_20051206195000.out -name "*L0.rman" -exec ls -l {} \; | awk '{ s+=$5 } END{printf("%.0f", s)}'`
$echo $m
7425089536... (0 Replies)
Hi there, I am checking disk spaced used on a box
# df -k | grep dsk | awk {'print $3'}
2055463
20165785
18310202
32274406
I want to somehow add them up but am no quite sure how to do this in a loop. ...i.e
for n in 'df -k | grep dsk | awk {'print $3}'
do
<some adding... (1 Reply)
I have two files as Count1 and Count2. The count contains only one values as 10 and count2 contains only one
values as 20. Now I want third file Count3 as count1+Count2. That is it should contain sum of two file(10+20=30) (3 Replies)
I have the following script in a shell
# The start of a filename
file=$(ls -tr $EMT*.dat | tail -1) # Select the latest file echo $file
file_seq=$( < /u02/sct/banner/bandev2/xxxxxx/misc/EFTSQL.dat)
echo $file_seq
file2 = '$file_seq + 1'
echo $file2
It is reading a file EFTSQL.dat... (3 Replies)
I am needing to create a variable(changing) and assign it a value(changing) ... I am using C-Shell..
Example:
foreach account in ($Accountlist)
set account_connect = "$account/$account_pass"
end
I want to make set account_connect to store various values ? $account_connect did not... (3 Replies)
Hi All,
I am connecting to Oracle DB from UNIX script. Want to capture all dates between start date and end date and store them in file. Once this is done, want to read dates one by one. How to achive this in UNIX and Oracle? Please let me know if you have any idea on the same.
Thanks and... (4 Replies)
Dear all,
I need your help for my question please
I have without header (space separated) and need to add two colomns at the beginning with values
my file look like :
rs1 a t 0.6
rs2 a c 0.3
rs3 t g 0.8
I need to a new file like:
1 100 rs1 a t 0.6
1 100 rs2 a c 0.3
1 100 rs3 t g... (3 Replies)
Hi
cat /tmp/xx.txt
1 4
1 5
1 6
2 1
2 1
2 1
i want to add the values of 2nd column resepect to 1st column values..for 1 in 1st column i need sum of all the values in 2nd column ..pls tell me hw to do it?? (8 Replies)
hey i am using this code to connect to sql , store the value in variable and then
compare it with another variable after some time by executing the same query
but the desired result is not coming
#!/bin/bash
val=$(sqlplus -s rte/rted2@rel76d2 <<ENDOFSQL
set heading off
set feedback off... (11 Replies)
Hi all,
a question for the Perl knowledgeable:
I have use warnings; enabled.
I use something like:
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
In the further code I only work with some of the returned variables, as the others I have no need for.
Though the... (1 Reply)
Discussion started by: zaxxon
1 Replies
LEARN ABOUT X11R4
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)