CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Pattern seacrh in Perl and redirecting to other file

 



raghupise
Novice

Oct 13, 2013, 2:05 AM

Post #1 of 15 (2650 views)
Pattern seacrh in Perl and redirecting to other file Can't Post

Hi All,

I have been trying to search a pattern called "Group name" starts with X(ex: XCT08L1) under List Name.

Please find the code snippet.

#!/usr/local/bin/perl

my $str = "";
open (FD, "<", "CSD.txt");
my @lines = <FD>;
close FD;

foreach (@lines) {
if(/LIST NAME:\t[A-Z]../) {
print STDOUT $_;
$str= $str.$_;
open (NW, ">", "RES.txt");
print NW $str;
close NW;
}
}


The above code is fetching Group Name in SearchPattern.txt.

I need to get List Name, Group Name (starts with X ) and its Trasactions into another file.

The attachment shows "List name", "Group Name" and "Transactions" detail.

Kindly guide how I can achieve this.
Thanks and Regards,
Raghu Pise
Attachments: PatternSearch.txt (5.29 KB)


Laurent_R
Veteran / Moderator

Oct 13, 2013, 2:50 AM

Post #2 of 15 (2643 views)
Re: [raghupise] Pattern seacrh in Perl and redirecting to other file [In reply to] Can't Post

Not absolutely sure to understand what you want, but if you are looking for items where the second column starts with X, you might do something like this:

Code
open my $FD, "<", "CSD.txt" or die "could not open file CSD.txt $!"; 
open my $OUT, ">", $outfile or die "could not open file $outfile $!";
my $list_name;
while (<$FD>) {
chomp;
$list_name = $1 if /LIST NAME\s+(\w+)/;
if (/GROUP\s+X/) {
my ($name, $transID, $time) = (split)[1..3] ;
print $OUT join " ", $list_name, $name, $transID, $time, "\n";
}
}
close $_ for ($FD, $OUT);



(This post was edited by Laurent_R on Oct 13, 2013, 2:54 AM)


raghupise
Novice

Oct 13, 2013, 5:14 AM

Post #3 of 15 (2637 views)
Re: [Laurent_R] Pattern seacrh in Perl and redirecting to other file [In reply to] Can't Post

Thanks for your quick reply Laurent_R.

It's populating 3rd column (DATE ADDED) along with Group Name. It would be better if we populate only 2nd column.

Along with this, I need to populate List Name, Goup Name and associated MAPSETS, TRANSACTIONS.

Please note "LIST NAME" has n number of "Group Name" which starts with X. Each "Group Name" has its "MAPSETS"/"TRASACTIONS".

Ex : LIST NAME: CT08LIST

GROUP 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

LIST NAME: CT09LIST

GROUP NAME: XCT09L1
----------

TRANSACTIONS: ABEI ABGL ABMM ABST AC36 ADO1 ADO2 ASCT ASMN
ASST AS2A AS2B AS2C AS20 AS22 ATCS ATGP ATGR
ATHI ATMA ATMB ATMD ATME ATMK ATMM ATMP ATMQ
ATMS ATM2 ATM3 ATM4 ATM5 ATM6 ATM7 ATM9 ATP1
ATP2 ATS1 ATS2 ATS4 ATS5 ATS6 ATUP AT01 AT02
AT03 AT04 AT05 AT06 AT07 AT08 AT09 AT10 AT11
AT12 AT13 AT14 AT15 AT16 AT18 AT19 AT20 AT21
AT22 AT23 AT24 AT25 AT26 AT28 AT29 AT30 AT31


I am attaching CSD.txt file once again so that you can have a look on the input file.

Kindly let me know if you didn't understand the work.

Thanks in advance.

Highly appreciated your quick reply on this.
Thanks and Regards,
Raghu Pise
Attachments: CSD.txt (5.29 KB)


Laurent_R
Veteran / Moderator

Oct 13, 2013, 2:49 PM

Post #4 of 15 (2623 views)
Re: [raghupise] Pattern seacrh in Perl and redirecting to other file [In reply to] Can't Post

Sorry, I really don't understand what you want.

Please give an example of the sample output you need, as well as how to derive it if this is not obvious.


raghupise
Novice

Oct 13, 2013, 11:03 PM

Post #5 of 15 (2616 views)
Re: [Laurent_R] Pattern seacrh in Perl and redirecting to other file [In reply to] Can't Post

Hi,

Sorry for inconvenience.

Please find the below output

Out put

LIST NAME: CT08LIST

GROUP 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


LIST NAME: CT09LIST

GROUP NAME: XCT09L1

----------

TRANSACTIONS: ABEI ABGL ABMM ABST AC36 ADO1 ADO2 ASCT ASMN
ASST AS2A AS2B AS2C AS20 AS22 ATCS ATGP ATGR
ATHI ATMA ATMB ATMD ATME ATMK ATMM ATMP ATMQ
ATMS ATM2 ATM3 ATM4 ATM5 ATM6 ATM7 ATM9 ATP1
ATP2 ATS1 ATS2 ATS4 ATS5 ATS6 ATUP AT01 AT02
AT03 AT04 AT05 AT06 AT07 AT08 AT09 AT10 AT11
AT12 AT13 AT14 AT15 AT16 AT18 AT19 AT20 AT21
AT22 AT23 AT24 AT25 AT26 AT28 AT29 AT30 AT31





In put file, CSD.txt has LIST NAME, under LIST NAME there are Group Name. I need to search Group Name starts with X.



Once we get Group Name there is Transactions/associated with each Group Name ( Ex:XCT08L1).



As I mentioned in output, List Name is displaying "Group Name( starts with X)" and associated Transactions/Mapset entry.



Please have a look on CSD.txt file, you will get clear idea about the requirement.



I hope its answer your question. If itís not clear, Kindly let me know where I need to give explanation.






Thanks and Regards,
Raghu Pise
Attachments: CSD.txt (5.29 KB)


Chris Charley
User

Oct 14, 2013, 9:22 AM

Post #6 of 15 (2597 views)
Re: [raghupise] Pattern seacrh in Perl and redirecting to other file [In reply to] Can't Post

I was able to get this output from the attached file.

Code
  
C:\Old_Data\perlp>perl t7.pl
LIST NAME: CT08LIST
GROUP 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

LIST NAME: CT09LIST
GROUP NAME: XCT09L1
TRANSACTIONS: ABEI ABGL ABMM ABST AC36 ADO1 ADO2 ASCT ASMN
ASST AS2A AS2B AS2C AS20 AS22 ATCS ATGP ATGR
ATHI ATMA ATMB ATMD ATME ATMK ATMM ATMP ATMQ
ATMS ATM2 ATM3 ATM4 ATM5 ATM6 ATM7 ATM9 ATP1
ATP2 ATS1 ATS2 ATS4 ATS5 ATS6 ATUP AT01 AT02
AT03 AT04 AT05 AT06 AT07 AT08 AT09 AT10 AT11
AT12 AT13 AT14 AT15 AT16 AT18 AT19 AT20 AT21
AT22 AT23 AT24 AT25 AT26 AT28 AT29 AT30 AT31
AT32 AT33 AT34 AT35 AT36 AT37 AT40 AT41 AT42
AT43 AT44 AT45 AT46 AT49 AT55 BADM BD05 BD56
BD71 BD72 BEMT BESL BE12 BE13 BE16 BE17 BE18
BE29 BE49 BE92 BE93 BE96 BE97 BE98 DRC7 EDE7
EDL7 NPAY VBBA VBFI

LIST NAME: CT09LIST
GROUP NAME: XCT09L2
TRANSACTIONS: BFCS BIND BMIO BMLD BOPE BSHT BSL3 BSTR BSXP
CMT1 CSLV DBTA D360 EBPS EBSB EBSC EBSH EBSM
EBUL EB00 EB01 EB02 EB03 EB04 EB05 EB06 EB07
EB10 EB15 EB20 EB25 EB30 EB35 EB40 EB41 EB42
EB45 EB46 EB50 EB55 ELBU EMON ICIA INT1 MC39
MC90 MC91 MONA MONB MON1 MON2 MON3 MON4 MON5
MON6 NITC NITP PR36 QC17 QC18 QWRT SHUT STCH
XB01 XCBR XCDC XCDI XCIA XCID XCNC XCPA XCPC
XCPP XCQW XCWR XDBR XDDC XDDI XDWR XFFC XFFR
XFGS XFMN XFSA XLCS XLFA XLFB XLFO XLME XLPR
XRCO

C:\Old_Data\perlp>



(This post was edited by Chris Charley on Oct 15, 2013, 4:59 PM)
Attachments: t7.pl (0.64 KB)


raghupise
Novice

Oct 15, 2013, 12:49 PM

Post #7 of 15 (2571 views)
Re: [Chris Charley] Pattern seacrh in Perl and redirecting to other file [In reply to] Can't Post

Hi,

Thanks for your reply.

This is what I wanted as output. There is slight change in your approach.

You have taken the input file CSD.txt in source code and derived the output.

I tried changing your code by considering the input file CSD.txt file and redirecting to RES.txt

It has some error.

Can you please help me out in this case.

I attaching CSD.txt file as attachment again.

< code>

#!/usr/bin/perl
use strict;
use warnings;
use 5.014;

open (FD, "<", "CSD.txt");
my @lines = <FD>;
close FD;

my %data;
{
local $/ = '';
#while (<DATA>)
#Lets read the data from input file called "CSD.txt"
foreach (@lines) {
#chomp;
if (/LIST NAME:\s+(.+)LIST/) {
$data{$1} = "LIST NAME: $1LIST";
}
elsif (/GROUP NAME:\s+(X(\w+)L\d+)/) {
open (NW, ">", "RES.txt");
print $data{$2}, "\n";
print "GROUP NAME: $1\n";
#my $trans = <DATA>;
# Need to replace with above statment. Struck here.
#print $trans;
close NW;
}
}
}
</code>
Thanks and Regards,
Raghu Pise
Attachments: CSD.txt (5.29 KB)


Chris Charley
User

Oct 15, 2013, 5:09 PM

Post #8 of 15 (2562 views)
Re: [raghupise] Pattern seacrh in Perl and redirecting to other file [In reply to] Can't Post

Hello Raghu,

The changes you made have made the program unworkable. I revised my program, 't7.pl' to read and write to and from the files you want. 't7.pl' gives the correct results.

I am pretty sure you don't understand the program or else you wouldn't have made the changes to it.

Try running my program as is, and then ask questions about what you don't understand.

Chris

Update: One reason your approach isn't working is that you are processing the file line by line. My program reads in a paragraph at a time instead. That's what the local $/ = ''; statement does. It changes the line endings from '\n' effectively to '\n\n+'. So the whitespace separating the different sections of your CSD.txt file act as 'line endings'. The program reads in these chunks rather then line by line.

Your reading the lines into an array defeats this method. You need to read a chunk at a time using the while loop.

Hope this sheds some light on what is happening.

Update 2: After thinking about it, you could read all the file into an array rather than using a while loop, but it would be necessary to read the file into the array where the input record separator is set to 'paragraph' mode, $/ = ''. It would probably be easier though to just use the program as is with the while loop, (unless you know where to read the file into an array to get the right effect).


(This post was edited by Chris Charley on Oct 15, 2013, 7:41 PM)


raghupise
Novice

Oct 15, 2013, 10:56 PM

Post #9 of 15 (2546 views)
Re: [Chris Charley] Pattern seacrh in Perl and redirecting to other file [In reply to] Can't Post

Thanks for your reply Chris.

Definitely I will go through your point.

Could you please check whether you have attached revised program 't7.pl'.

Looks like you have not attached t7.pl

Kindly check from your end and revert
Thanks and Regards,
Raghu Pise


Chris Charley
User

Oct 16, 2013, 8:38 AM

Post #10 of 15 (2527 views)
Re: [raghupise] Pattern seacrh in Perl and redirecting to other file [In reply to] Can't Post

I revised the program in my first attachment, but will attach it here again.

Chris
Attachments: t7.pl (0.76 KB)


raghupise
Novice

Oct 16, 2013, 10:46 PM

Post #11 of 15 (2499 views)
Re: [raghupise] Pattern seacrh in Perl and redirecting to other file [In reply to] Can't Post

Hi Chris,


1. You are doing pattern search for "List Name" which has CT09LIST and CT09LIST.

For above List Name you have used below code.

if (/(LIST NAME:\s+(.+)LIST)/)

What would be the pattern search if it starts with A to Z and end with A to Z or

combination of any characters/digits.



Please note that List Name has 8 digit characters/digit and it could be any combination of

any characters or digits.

Ex : CLT1245Z, A1B2C34Z

2. And also Group Name only starts with "X" and rest of the characters is digits/characters.

Here Group name might have 4 characters or 8 characters or combination of any characters/digit.

Ex: XPS02L1, XPSPBL1, XTSG, XTSS01

What would be the pattern search in above case?

Present code:

elsif (/(GROUP NAME:\s+X(\w+)L\d+)/)

3. I am not able to find out how you are fetching Transactions details in your code. Please suggest where

in program itís executing

I am attaching once again your program here.
Thanks and Regards,
Raghu Pise
Attachments: t7.pl (0.81 KB)


Chris Charley
User

Oct 18, 2013, 9:03 AM

Post #12 of 15 (2468 views)
Re: [raghupise] Pattern seacrh in Perl and redirecting to other file [In reply to] Can't Post

Hi Raghu,

The program I gave you worked on the 'CSD.txt' file you provided.

Some answers to your questions.

1. You are doing pattern search for "List Name" which has CT09LIST and CT09LIST.

Yes, that is the sample data you provided.

2. And also Group Name only starts with "X" and rest of the characters is digits/characters.

Also the sample data you provided.

3. I am not able to find out how you are fetching Transactions details in your code.

The line below does that.

my $trans = <FD>; # read next 'chunk'

It is not possible to determine what regular expressions to use to capture 'List name' and 'Group name' from the information you have provided.

How do you match the two? In your sample, List names ended with 'LIST' but now you say, Please note that List Name has 8 digit characters/digit and it could be any combination of any characters or digits.

I don't understand your specifications.

Perhaps you could attach a file containing examples of the new specifications.

Chris


raghupise
Novice

Oct 19, 2013, 12:16 PM

Post #13 of 15 (2441 views)
Re: [Chris Charley] Pattern seacrh in Perl and redirecting to other file [In reply to] Can't Post

Hi Chris,



I am really sorry for not giving exact information which is required for you, apologies.

The attachment CSD-New.txt has List Name, Group Name and Transactions.

Could you please help me out to produce below output?

I need to segregate in below format.



Kindlelet me know if you need further information



The Output( Its sample example for CT08LIST)



Ex: LIST NAME: CT08LIST
GROUP 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

LIST NAME: CT09LIST



GROUP NAME: XCT09L1
----------
TRANSACTIONS: ABEI ABGL ABMM ABST AC36 ADO1 ADO2 ASCT ASMN
ASST AS2A AS2B AS2C AS20 AS22 ATCS ATGP ATGR
ATHI ATMA ATMB ATMD ATME ATMK ATMM ATMP ATMQ
ATMS ATM2 ATM3 ATM4 ATM5 ATM6 ATM7 ATM9 ATP1
ATP2 ATS1 ATS2 ATS4 ATS5 ATS6 ATUP AT01 AT02
AT03 AT04 AT05 AT06 AT07 AT08 AT09 AT10 AT11
AT12 AT13 AT14 AT15 AT16 AT18 AT19 AT20 AT21
AT22 AT23 AT24 AT25 AT26 AT28 AT29 AT30 AT31




Thanks,

Raghav


Thanks and Regards,
Raghu Pise
Attachments: CSD-New.txt (250 KB)


Chris Charley
User

Oct 20, 2013, 11:46 AM

Post #14 of 15 (2418 views)
Re: [raghupise] Pattern seacrh in Perl and redirecting to other file [In reply to] Can't Post

Just parsing the 'list' names and the 'group' names gave me the output (below). There were only 22 list names but there were 184 group names (all beginning with X, I just stripped out the 'X').

Do you only want to print out the group names where there is a matching list name (and associated data, mapsets and transactions).

The file is irregular. mapsets and transactions are separated by a blank line at times and other times are not separated by a blank line. It is difficult to design a program to handle these irregular cases.


Code
 
C:\Old_Data\perlp>perl t33.pl csd.txt
list count: 22
group count: 184
$VAR1 = {
'CT08LIST' => 2,
'CT09LIST' => 2,
'DB16LIST' => 1,
'DB17LIST' => 1,
'DFH$IVPL' => 1,
'DFHLIST' => 1,
'FALCLIST' => 1,
'FALCLST1' => 1,
'PAAXLIST' => 1,
'PAA1LIST' => 1,
'PAA2LIST' => 1,
'PAA3LIST' => 1,
'PAC1LIST' => 1,
'PAC2LIST' => 1,
'PAC3LIST' => 1,
'PAC4LIST' => 1,
'PA01LIST' => 1,
'PA02LIST' => 1,
'PA03LIST' => 1,
'PA04LIST' => 1,
'PA05LIST' => 1,
'PA06LIST' => 1
};
$VAR2 = {
'CT09L1' => 2,
'CT09L2' => 1,
'CT09R1' => 1,
'DB16L1' => 1,
'DB17L1' => 1,
'DB17L2' => 1,
'DB17R1' => 1,
'HOMEL1' => 1,
'IVRL1' => 1,
'NDSCTG' => 1,
'NDSJTRN' => 1,
'NDSPRI2' => 1,
'PA0XL1' => 1,
'PA01L1' => 1,
'PA02L1' => 1,
'PA03L1' => 1,
'PA45L1' => 1,
'PA60L1' => 1,
'PA81L1' => 1,
'PA81R1' => 1,
'PA82L1' => 1,
'PA83L1' => 1,
'PA83R1' => 1,
'PA88L1' => 1,
'PCAUOPS' => 1,
'PCCCL1' => 1,
'PCCCR1' => 1,
'PCCEL1' => 1,
'PCCLL1' => 1,
'PCCML1' => 1,
'CT08L1' => 1,
'PCCPL1' => 1,
'PCCPR1' => 1,
'PCCTL1' => 1,
'PCCTR1' => 1,
'PCCVL1' => 1,
'PCCVR1' => 1,
'PCPHBCK' => 1,
'PCPHL1' => 1,
'PCPHL2' => 1,
'PCPHR1' => 1,
'PCPSL1' => 1,
'PCPSR1' => 1,
'PCVTL1' => 1,
'PDPHBCK' => 1,
'PDPHL1' => 1,
'PDPHL2' => 1,
'PDPHR1' => 1,
'PDVTL1' => 1,
'PM0XL1' => 1,
'PM01R1' => 1,
'PM02R1' => 1,
'PM03R1' => 1,
'PM04R1' => 1,
'PM81L1' => 1,
'PM82L1' => 1,
'PM83L1' => 1,
'PRAUOPS' => 1,
'PRA1L1' => 1,
'PRA1L2' => 1,
'PRA1L3' => 1,
'PRA1L4' => 1,
'PRCL1' => 1,
'PRC1L1' => 1,
'PRC1L2' => 1,
'PRC1L3' => 1,
'PRC1L4' => 1,
'PRC1L5' => 1,
'PRC1L6' => 1,
'PRIBL2' => 1,
'PRIBR1' => 1,
'PRIPL1' => 1,
'PRIVL1' => 1,
'PRI1L1' => 1,
'PRI1L2' => 1,
'PRI1L3' => 1,
'PRI1L4' => 1,
'PRI1L5' => 1,
'PRI1L6' => 1,
'PRI1L7' => 1,
'PRI2L1' => 1,
'PRI2L2' => 1,
'PRI2L3' => 1,
'PRI2L4' => 1,
'PRI2L5' => 1,
'PRI2L6' => 1,
'PRI2L7' => 1,
'PRI2L8' => 1,
'PRMRL1' => 1,
'PRM1L1' => 1,
'PRM4L1' => 1,
'PRM5L1' => 1,
'PRM7L1' => 1,
'PRM9L1' => 1,
'PRNABCK' => 1,
'PRNAL1' => 1,
'PRNAL2' => 1,
'PRNAR1' => 1,
'PRPOL1' => 1,
'PRT1L1' => 1,
'PRT1R1' => 1,
'PRT1R2' => 1,
'PRT1R3' => 1,
'PRT1R4' => 1,
'PRT1R6' => 1,
'PRT2L1' => 1,
'PRT2R1' => 1,
'PRT2R2' => 1,
'PRT2R3' => 1,
'PRT2R4' => 1,
'PRT2R6' => 1,
'PRVFL1' => 1,
'PRVTL1' => 1,
'PRVTL2' => 1,
'PRZFL1' => 1,
'PRZFL10' => 1,
'PRZFL2' => 1,
'PRZFL3' => 1,
'PRZFL4' => 1,
'PRZFL5' => 1,
'PRZFL6' => 1,
'PRZFL7' => 1,
'PRZFL8' => 1,
'PRZFL9' => 1,
'PSCAL1' => 1,
'PSCBL1' => 1,
'PSCCL1' => 1,
'PSCCL2' => 1,
'PSCCL3' => 1,
'PSC1L1' => 1,
'PSC2L1' => 1,
'PSC2L2' => 1,
'PSC3R1' => 1,
'PSC4L1' => 1,
'PSC4R1' => 1,
'PSC5L1' => 1,
'PSEDL1' => 1,
'PSF0L1' => 1,
'PSF0R1' => 1,
'PSPBL1' => 1,
'PSTRL1' => 1,
'PS01L1' => 1,
'PS01R1' => 1,
'PS02LJP' => 1,
'PS02L1' => 1,
'PS02R1' => 1,
'PS03L1' => 1,
'PS03R1' => 1,
'PS04L1' => 1,
'PS04R1' => 1,
'PT81L1' => 1,
'PT81R1' => 1,
'PT82L1' => 1,
'PT82R1' => 1,
'PT82R2' => 1,
'PT82R3' => 1,
'PT82R4' => 1,
'PT82R5' => 1,
'PT82R6' => 1,
'PT82R7' => 1,
'PT82R8' => 1,
'PT83L1' => 1,
'PT84R1' => 1,
'RCCL1' => 1,
'RC28L1' => 1,
'RC32L1' => 1,
'RC32L2' => 1,
'RC34L1' => 1,
'RC34L3' => 1,
'RC34L4' => 1,
'RC34R1' => 1,
'RC35L1' => 1,
'RC37BCK' => 1,
'RC37L1' => 1,
'RC37R1' => 1,
'RMSL1' => 1,
'RMSTL1' => 1,
'SECL1' => 1,
'TCPIPL1' => 1,
'TSG' => 1,
'TSS01' => 1,
'VAXL1' => 1,
'VBANKL1' => 1,
'VBNKL1' => 1
};



raghupise
Novice

Oct 20, 2013, 2:59 PM

Post #15 of 15 (2410 views)
Re: [Chris Charley] Pattern seacrh in Perl and redirecting to other file [In reply to] Can't Post

Hi Chris,

I want to populate only List Name, Group Name and Trasactions. Please igonre mapset under each group name

Output should be like ( itís just for one List name)

LIST NAME: PA81LIST
----------

GROUP NAME: XTCPIPL1
----------

TRANSACTIONS: CSKD CSKE CSKL EZAC EZAO TSL1

I am attaching two different file CSD-July1.txt and CSD-july2.txt separtley.

Due to size constrain, I have devided the file into two. Please consider these files as one file for input in your program.

I would like to inform one thing here, your program which gave earlier (t7_1.pl) works fine but it has few bugs.

I will highlight those bugs here

1. Itís not able to find out pattern search for list name which has special characters ( LIST NAME: DFH$IVPL ).

2. Itís not able to find out a pattern search for group name which has 4 to 8 digit.

Kindly check these bugs from your previous program (t7_1.pl)


Thanks and Regards,
Raghu Pise
Attachments: CSD-July1.txt (201 KB)
  CSD-July2.txt (141 KB)

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives