suppose I have a log file ~ temp.log which contains some information.I need to find 3 patterns from that file..so that if those 3 patterns are found in a file.. then a test case is termed as "passed".
For example : temp.log
20050203 193110776+0900 jpn-docsun1 spamctrl 22551 0 20 Debg;MsgTrace( +1/0) Thread SRMCHandler 1941760 started 20050203 193110777+0900 jpn-docsun1 spamctrl 22551 0 20 Trac;MsgTrace( +1/0) Master:Got a listOp 101 List 4 20050203 193110778+0900 jpn-docsun1 spamctrl 22551 0 15 Trac;MsgTrace( +1/0) Got an update notification 4:101:480344 20050203 193110781+0900 jpn-docsun1 spamctrl 22551 0 12 Debg;MsgTrace( +1/0) spamctrl:begin listssync/expire 20050203 193110782+0900 jpn-docsun1 spamctrl 22551 0 12 Note;BlockItem +Added(1/0) ListAddOp:4:<rbsctest1@openwave.com> 20050203 193110782+0900 jpn-docsun1 spamctrl 22551 0 12 Note;BlockItem +Added(1/0) ListAddOp:4:<rbsctest2@openwave.com> 20050203 193110783+0900 jpn-docsun1 spamctrl 22551 0 12 Note;ListOpDon +e(1/50) LISTADD:List=4:Items=2 20050203 193110783+0900 jpn-docsun1 spamctrl 22551 0 12 Debg;MsgTrace( +1/0) spamctrl:end listssync/expire 20050203 193110792+0900 jpn-docsun1 spamctrl 22551 0 20 Debg;MsgTrace( +1/0) Thread SRMCHandler 1941760 finished 20050203 193111379+0900 jpn-docsun1 spamctrl 22551 0 10 Trac;MsgTrace( +1/0) Received a connection from '10.196.4.110' 20050203 193111380+0900 jpn-docsun1 spamctrl 22551 0 21 Debg;MsgTrace( +1/0) Thread SRMCHandler 1941048 started 20050203 193111391+0900 jpn-docsun1 spamctrl 22551 0 21 Debg;MsgTrace( +1/0) Thread SRMCHandler 1941048 finished 20050203 193111705+0900 jpn-docsun1 spamctrl 22551 0 16 Trac;MsgTrace( +1/0) Handled:<rbsctest1@openwave.com>:[10.196.4.110]:0: 0:: 20050203 193112013+0900 jpn-docsun1 spamctrl 22551 0 12 Debg;MsgTrace( +1/0) spamctrl:begin listssync/expire 20050203 193112014+0900 jpn-docsun1 spamctrl 22551 0 12 Debg;MsgTrace( +1/0) spamctrl:end listssync/expire 20050203 193112728+0900 jpn-docsun1 spamctrl 22551 0 16 Trac;MsgTrace( +1/0) Handled:<rbsctest1@openwave.com>:[10.196.4.110]:0: 0:: 20050203 193112885+0900 jpn-docsun1 spamctrl 22551 0 16 Note;BlockedSe +nder(1/0) <rbsctest1@openwave.com>:[10.196.4.110]:4:3:d ropspam:block


I need to find 2 patterns in this file : 1. Note;ListOpDone(1/50) LISTADD:List=4:Items=2
2. Note;BlockedSender(1/0) <rbsctest1@openwave.com>:[10.196.4.110]:4:3:dropspam:block

I have converted both patterns using quotemeta and they look like this. 1.LISTADD\:List\=4\:Items\=2
2.Note\;BlockedSender\(1\/0\)\ \<rbsctest1\@openwave\.com\>\:\[10\.196\.4\.110\]\:4\:3\:dropspam\:block
How to search for these 2 patterns in an effient way from a file ?

20050207 Janitored by Corion: Put log excerpt into code tags


In reply to how to search 3 different patterns from a file by athalyes

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.