My requirement is to get the List name which has Group name starts with X. I need to extract Transactions code which comes under Group name as well. The output should bemy $str = ""; open (FD, "<", "CSD.txt"); my @lines = <FD>; close FD; foreach (@lines) { if(/GROUP NAME: X[A-Z]../) { print STDOUT $_; $str= $str.$_; open (NW, ">", "RES.txt"); print NW $str; close NW; } }
I can send the input file wherein you can have a look on the file. Kindly let me know your mail id so that I can send the input file/exact requirementList name: CT08LIST GROUP XCT08L1 04.290 17:05 Trasactions ROUP NAME: XCT08L1 ---------- MAPSETS: AGCEM1 AGHEM1 AGMMM1 AGONM1 AGPEM1 + AGPUM1 AGREM1 AGRUM1 AGSEM1 AGSUM1 AGZ1M1 AGZ2M1 AGZ3M1 AGZ4M1 + AGZ5M1 TRANSACTIONS: ACBA ACBE ACBL ACBR ACBU + AGMM AGSU AGTO AST5 AST7 AST9 AXTO BAC1 BCA1 + BCA2 BCA3 BCA4 BCA5 BD11 BE1A BE44 BM16 BM17 + BM6A BSL3 BSVL BS09 BS11 BS12 BS13 BS14 BTM2 + BWR2 HMI8 IBVS IM01 IM02 IM03 IM07 IM18 IM21 + IM25 MSOD NPS2 STP1 XB01 XB02 XB03 XB04 XB05 + XB06 XB07 XB08 XB10 XB11 XB12 GROUP NAME: XCT09L1 ----------
In reply to Re^2: Perl Script to extract pattern and redirect to another file
by Raghu1
in thread Perl Script to extract pattern and redirect to another file
by Raghu1
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |