title: Find last line matching a pattern
body: <p>I am running multiple data collectors scripts that extracts data from social platform. Each logs the progress in their own log file. I have to monitor them manually using the ps command. </p>
  
  <p>I want to make a script in bash which on executing tells me if the collector is running or stopped. According to my plan, it will go into the log file, skip to the end and then search the log upward  for the keywords like:
  1. if collector is running, log file says <strong>Processing Line</strong>; 
  2. if collector is stopped , log file says <strong>Exception</strong>;</p>
  
  <p>It will the search the file upward to get latest occurrence of any 2 of the above cases. 
  I want it to stop searching the log file when it has found either one of these.
  And then i will echo the status. </p>
  
  <p>Currently i am able to skip to the end and then search it upwards, but i don't know how to make the search stop if it finds any one of the lines containing the searched patterns first.? And how will <strong>if else</strong> will be implemented according to this? </p>
  
  <p>My code is </p>
  
  <pre><code>cat **LogFile** | grep -E 'Processing line|Exception' | tail -1
  </code></pre>