Page 1 of 1

need to print searched word only if both words found in a

Posted: Fri Jan 31, 2014 6:56 pm
by sanpatel2
I have 1000s of text files I need to search for a particular failure. All my text files contain a word I want to search but I only want it found if it is followed by a FAIL.
I do not want it to appear if it passes. Is there a way to do this?

Below I copied the format in which this test appears in my files. I only want my search to return tg_format_tb and FAIL if this test fails as below, otherwise I don't want the search to return anything for a particular file.

Testing TG->PE Timing Formats [pe_tg_format_tb]
Testing NRZ Format 5.0MHz Test (200 ns) with Edge Strobes
*FAIL 10060 PE1 142 b_7


Is it possible? I am not a software person, so coding anything is beyond me.
Appreciate your help.

I forgot there are several tests in a text file and there may be multiple fails. Is there a way to avoid all other fails?


Thank you

Re: need to print searched word only if both words found in

Posted: Wed Feb 05, 2014 11:43 am
by DigitalVolcano
This regular expression works for your case - it does assume that the "FAIL" occurs two lines below the tg_format_tb

Code: Select all

tg_format_tb.*\r\n.*\r\n.*FAIL

Re: need to print searched word only if both words found in

Posted: Fri Feb 07, 2014 8:19 pm
by sanpatel2
I tried this for a different test block, and it did not work. (dps_ishare_tb *\r\n.*\r\n.*FAIL) Probable because *Fail is not 2 lines below. How do I get it to look or fail in the text below:

Testing DPS current share [dps_ishare_tb]
Testing DPS current share in x2 mode (No X pins)
Testing 'a' pins with DPS range 1
Testing 'a' pins with DPS range 2
Testing 'a' pins with DPS range 3
Testing 'a' pins with DPS range 4
Testing 'a' pins with DPS range 5
Testing 'a' pins with DPS range 6

Status Test Brd Chan Range @ CalRes (Ohms) Expect Actual Delta Tolerance
----------------------------------------------------------------------------------------------------------------------
*FAIL 86310 DP2 5 a_dps2a Rng6 @ (5.000 Ohms) -164.895 mA -97.584 mA 67310.586 uA +- 2.000 mA

This FAIL can appear in any order and for any range.


Thanks,

Re: need to print searched word only if both words found in

Posted: Sat Feb 08, 2014 2:16 pm
by DigitalVolcano
dps_ishare_tb.*FAIL

The above (with the "Dot matches newline" option checked) will find the fail any number of lines below. Unfortunately it may catch a fail for a different test if there is one further down the file - we need a marker that signifies it is the end of that current test?

Re: need to print searched word only if both words found in

Posted: Sun Feb 09, 2014 4:59 pm
by sanpatel2
End marker will be dps_leakage_tb. So any FAIL between dps_ishare and dps_leakage and also print the test block name along with FAIL data.

Thank you,

Re: need to print searched word only if both words found in

Posted: Mon Feb 17, 2014 1:44 pm
by DigitalVolcano
Hmmm, I haven't found a good way of doing this yet.

Code: Select all

dps_ishare_tb.*FAIL.*dps_leakage_tb