Print out the amount of times 2 words appear in the syslog. But also have it tell me how many times for each hour
- by wolfspinone
So I'm trying to create a bash script that looks for two words in my syslog file.
Then I want the script to print out how many times those two words have appeared.
Also I want it to print it out for every hour of the day.
So like if the word dog appeared 4 times during the first hour of today, it says Hour one, dog 4.
Finally at the end of the script I want it to print out how many times those words appeared all day.
The sudo code I have thus far is
if 2 > hour
find permit
find block
print both
finish
if 1 < hour < 2
find permit
find block
print both
finish
if 2 < hour < 3
find permit
find block
print both
finish
command is
grep -o "\WORD\" Syslog.txt * | sort | uniq -c