Never mind, I've figure it out.
Thanks

--- Paul <[EMAIL PROTECTED]> wrote:

> Hi All,
> 
> I am trying to find duplicate names in a text file
> and
> report them by Section number and page number
> but my output is not totally correct. Can somebody
> help me iut to find out what's wrong in my script.
> This is the output I get 
> DUPLICATE IN BETWEEN SECTION
>   SLOTA : in Section/Pages
>         Section1  ---> 10 12
>         Section2  ---> 10 12 16 18
>         Section3  ---> 10 12 16 18 25
>   NC_SLOTA : in Section/Pages
>            Section1  ---> 10 13
>   V3P3_G4 : in Section/Pages
>           Section2  ---> 16 18 20
>           Section3  ---> 16 18 20 25
>   JOSH : in Section/Pages
>           Section2  ---> 16 19
>   NC_SNAP : in Section/Pages
>            Section2  ---> 19 20
>   NC_A : in Section/Pages
>          Section3  ---> 21 23 25
> ------------
> And I should get something like this:
> DUPLICATE IN BETWEEN SECTION
>   SLOTA : in Section/Pages
> Section1  ---> 10 12
> Section2  ---> 16 18
> Section3  ---> 25
> ....
> ....
> 
> ## Find_dup.pl
> use strict;
> my $file = "C:/ALL.txt";
> print "\nDUPLICATE IN BETWEEN SECTION\n";
> &LOOK_IN_ALL;
> 
> sub LOOK_IN_ALL
>  {
>    my @all;
> 
>    #open (FF,$file);
>    my %rq;
>    while(<DATA>)
>     {
>       chomp;
>       my ($sec,$nn) = split (/::/);
>       $rq{$nn}++;
>       push (@all,$nn) if ( $rq{$nn} == 2 );
>     }
>    close(FF);
>    foreach my $each (@all)
>     {
>       my %qqq;
>       my @allpg;
>                         # use of GNU tool grep
>       my @slurp = `grep -w $each $file`; 
>       print "  $each : in Section/Pages \n";
>         foreach (@slurp)
>          {
>            chomp;
>            my ($ss,$pg) =
> m!^(Section\d).*\.(\d+)::!;
>            push (@allpg, $pg);
>            $qqq{$ss} =  [ @allpg ] ;
>          }
>         foreach my $x ( sort keys %qqq )
>          {
>            print "$x  ---> @{$qqq{$x}} \n";
>          }
>         print "\n";
>     }
>  }
> __DATA__
> ## C:/ALL.txt
> Section1->PAGE.10::NC_SLOTA
> Section1->PAGE.10::SLOTA_EXTFLASHAD5
> Section1->PAGE.10::SLOTA
> Section1->PAGE.12::SLOTA
> Section1->PAGE.13::NC_SLOTA
> Section1->PAGE.13::NC_SLOTD_A19
> Section1->PAGE.15::IOC_SCL
> Section1->PAGE.15::IOC_SDA
> Section1->PAGE.15::RESERVED_1
> Section2->PAGE.16::V3P3_G4
> Section2->PAGE.16::SLOTA
> Section2->PAGE.16::JOSH
> Section2->PAGE.16::JOSH_PCIAD30
> Section2->PAGE.18::SLOTA
> Section2->PAGE.18::NC_SNAP12TX_A10
> Section2->PAGE.18::NC_SNAP12TX_A4
> Section2->PAGE.18::V3P3_G4
> Section2->PAGE.19::NC_SNAP
> Section2->PAGE.19::NC_SNAP12RX_K4
> Section2->PAGE.19::JOSH
> Section2->PAGE.20::NC_ANM_SDI24
> Section2->PAGE.20::NC_SNAP
> Section2->PAGE.20::V3P3_G4
> Section2->PAGE.20::ANM_INH
> Section3->PAGE.21::NC_ANM_I2CSLAVEID1
> Section3->PAGE.21::NC_A
> Section3->PAGE.22::V1P5_SW
> Section3->PAGE.23::NC_A
> Section3->PAGE.24::MONFCB1_QSERCMB3_D2
> Section3->PAGE.25::NC_A
> Section3->PAGE.25::V3P3_G4
> Section3->PAGE.25::SLOTA
> ##  END of DATA FILE
> 
> 
> 
> 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam
> protection around 
> http://mail.yahoo.com 
> _______________________________________________
> Perl-Win32-Users mailing list
> [email protected]
> To unsubscribe:
> http://listserv.ActiveState.com/mailman/mysubs
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to