I want to write a batch script that should read a text file line by line and search for a keyword.
If the keyword is found it should return value 0 else it should return 1. Like this it should keep on incrementing the value until the end of the file. The output should go to a file.
The sample log is as follows,
Website is available HTTP/1.1 200 OK
Website is available HTTP/1.1 200 OK
Website is available HTTP/1.1 200 OK
Website is available HTTP/1.1 200 OK
Website is available HTTP/1.1 200 OK
Website is available HTTP/1.1 200 OK
Basically I want to count the number of times the website failed. So, if the website is ok, then it should return value '0' if it is not then value '1'.
Last but not least I want the total number of times the website failed.