One day , I gone though a scenario where I have to count the number of lines of error string in a file for specific duration in the linux server using single command. I require it as I will be repeating it for multiple iterations of testing cycle.
As I did not have much experience in linux commands , I spent more time in browsing various web pages and finally I was able to join the commands in order to get one line command.
I think this might be useful to many testers like me
Linux command for finding number of lines of unique string in a file for specific duration:
sed -n ‘/2013-12-24 20:20:00/,/2013-12-24 23:59:59 /p’ logfile.log | grep ‘error’ | wc -l
Or you can use this as well for quick view,
grep -i ‘error’ filename.log
Here You can update any string that has to be searched in grep ‘error’