I'm using WebInject (CLI not GUI) to test out online web services. I was going to go with a third party until I found this little gem and realized what I could save...
What I want to accomplish is to grep the results of WebInject (Perl script) . If it finds a pattern then pipe the results to mail. I'm new at this and am not quite sure how to write the logic for evaluating the results and sending it to mail.
This is what I have so far:
$ perl webinject.pl | grep 'TEST CASE FAILED'
I only want to send an email if grep finds a match, otherwise no email should be sent. I'd like to set this up with cron to run at 10 or 15 minute intervals.
As a side note, is grep able to grab leading and trailing characters from a matching pattern?
UPDATE 1: figured out leading and trailing lines (-A # -B #)
Thanks very much!