Thursday, 3 November 2011

Grep Issue

Grep Issue

Hey Forum,

I have a greping issue i was hoping to get help with. I am running a large series of test scripts and the output from these scripts gets put into a very large log file. I would like to grep through this file to pull out the results of only the tests that failed.

This is an example of how the log file looks:

==============================================
Test case: test_1.txt
.
.
.
The settings of the test case
.
.
.
Errors:
verdicts....blah
verdicts....blah
verdicts....blah
verdicts....blah

==============================================
Test case: test_2.txt
.
.
.
The settings of the test case
.
.
.

RESULT: SUCCESS

==============================================


..And so on for several hundred tests...I only really need to see the information about the failed test cases like below:

Test case: test_1.txt
.
.
.
The settings of the test case
.
.
.
Errors:
verdicts....blah
verdicts....blah
verdicts....blah
verdicts....blah


My thinking is that it would be easiest to grep from ==== to ==== and if there is the word "Errors:" between them...but i cant seem to figure out how to do this? Is there an easy way to do this?

Thanks.

No comments:

Post a Comment