hi Monks... i have to search for the PID ( number) and a string in a file . after searching in log file it should print in a output file. the input is like.. perl test.pl -f logfile -o new -p 10570 -s cm_child.c and output should have all the lines from one D/E/M/W to other.... as all lines start with anyone of this.
D Fri Nov 21 14:09:41 2008 TME_BILLING_COE cm:10570 cm_child.c(107) +:4385 1:blrdxp-santbs:CustomerCenter:0:AWT-EventQueue-0:83:1227256900 +:0 XXX CMAP: op_custom() past op_decode, opcode: PCM_OP_CUST_VALI +DATE_CUSTOMER D Fri Nov 21 14:09:41 2008 TME_BILLING_COE cm:10570 fm_cust_validat +e_customer.c:92 1:blrdxp-santbs:CustomerCenter:0:AWT-EventQueue-0:83: +1227256900:0 op_cust_validate_customer input flist # number of field entries allocated 20, used 3 0 PIN_FLD_POID POID [0] 0.0.0.1 /plan -1 0 0 PIN_FLD_ACCOUNT_OBJ POID [0] 0.0.0.1 /account -1 0 D Fri Nov 21 14:09:41 2008 TME_BILLING_COE cm:10570 fm_cust_pol_pre +p_payinfo.c:113 1:blrdxp-santbs:CustomerCenter:0:AWT-EventQueue-0:83: +1227256900:0 op_cust_pol_prep_payinfo input flist # number of field entries allocated 20, used 5 0 PIN_FLD_POID POID [0] 0.0.0.1 /payinfo/invoice -1 0 D Fri Nov 21 14:09:41 2008 TME_BILLING_COE cm:10570 fm_cust_pol_val +id_payinfo.c:276 1:blrdxp-santbs:CustomerCenter:0:AWT-EventQueue-0:83 +:1227256900:0 op_cust_pol_valid_payinfo input flist # number of field entries allocated 20, used 8 0 PIN_FLD_ACCOUNT_OBJ POID [0] 0.0.0.1 /account -1 0 0 PIN_FLD_INVOICE_OBJ POID [0] 0.0.0.1 /invoice -1 0 0 PIN_FLD_PAYMENT_OFFSET INT [0] -1 1 PIN_FLD_ADDRESS STR [0] "123\t\t\t" D Fri Nov 21 14:09:41 2008 TME_BILLING_COE cm:10570 fm_cust_pol_val +id_payinfo.c:2569 1:blrdxp-santbs:CustomerCenter:0:AWT-EventQueue-0:8 +3:1227256900:0 Payment term not defined in the inut flist, there is nothing t +o validate # number of field entries allocated 20, used 8 0 PIN_FLD_ACCOUNT_OBJ POID [0] 0.0.0.1 /account -1 0

In reply to searching for string & number.. by jaggu_bg

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.