How to find a particular word from a file

Hello Experts,

I have to count the word like "RESULT_CODE: : -6" from the multiple files names like req.result_2_vqx-71144750.log for a particular date. Lets suppose the date is 10 OCT 2011.

How I can do it with a single command in Solaris environment.

Reagrds
Oracle User

perl -MPOSIX -e'
  ($dt, $patt, $logs) = @ARGV;
  $dt eq strftime("%Y-%m-%d", localtime +(stat)[9]) and
    print $_, " ==> ", qx/grep -c "$patt" $_/ 
    for glob "$logs";
    ' '2011-10-10' 'RESULT_CODE: : -6' 'req.result*.log'

This command is not working. Is there any other way to do this.

Regards
Oracle User

"This command is not working" is a useless answer for anybody who tries to help you. Show some effort and supply at least an error message.

How does the date fit in? Do you have some example input?

I have not written that the solution given is "the useless one", in my post anywhere.

Also there is no error message displayed for the above command. my only intention was to know the exact command ...thats all !!

How do you know that I have not tried enough on this problem...instead of writing a long essay for a particular forumn. please metion the solution if you know. This will save your time as well as mine.

Regards
Oracle User

---------- Post updated at 10:50 PM ---------- Previous update was at 10:45 PM ----------

@CarloM,
Here is the file, for Nov 7

-rw-rw-r--   1 oracle   dba          962 Nov  7 14:54 req.267891147-67891246.log

There are lots of logs for this particular date; lets say between 500-1000 logs. I need a command which filter a particular word from all the logs and give the count as a result.

Regards
Oracle User

As you notice, this doesn't help us a lot to save our time too...
Better is to post some lines of your log file and the desired output.

ls -l | awk '/Oct 10/ {print $9}' | xargs grep "RESULT_CODE: : -6" | wc -l

You misunderstood me - check what Franklin said or read my post again :wink: