View Full Version : Basic Arithmetic?

July 26th, 2007, 03:27 PM
I'm unable to come up with a script that works at all for this....

What I want to do is have a simple grep go through a file (000000*.log) each day, and search for the word "new", and add up the sum of all of those "new" words.

I tried to do it in bash, but have yet to come up with anything successfully. : (

July 26th, 2007, 03:44 PM
Can't you just use 'wc -l' or am I misunderstanding the problem?

grep "new" 000000*.log | wc -l

July 26th, 2007, 04:11 PM
That is exactly what I needed thank you very much. : )

Mr. C.
July 27th, 2007, 05:56 AM
grep -c new 000000*.log