http://qs321.pair.com?node_id=726337

jaggu_bg has asked for the wisdom of the Perl Monks concerning the following question:

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