Hi
I have been reading your newsletters for some time. I would like to know some information on counting the repeating lines in a file. I currently have a script that grabs all URL address to a file, what I am trying to find is count the no. of times the URLs are found in that output file.
Any help will be appreciated.
Preethi
Below is my script:
use strict;
#use IO::Socket;
open (READ, "sample_scoff.txt"
|| die " cannot open output file \n";
my @scon_rd = <READ>;
open (WRITE, ">scon_wr.txt"
|| die " cannot open output file \n";
foreach my $line (@scon_rd) {
if ($line =~ m/^\d+/m )
{
my $num_line = $line;
#print "$num_line";
if ($num_line =~ m/\s(http.*?)\s/mg)
{
print "$1 \n\n";
}
}
close (READ);
}
open (ATon, "scon_wr.txt"
|| die " cannot open scon write file \n";
my @ATwr = <ATon>;
.................??????????
close (WRITE);
close (ATon);
I have been reading your newsletters for some time. I would like to know some information on counting the repeating lines in a file. I currently have a script that grabs all URL address to a file, what I am trying to find is count the no. of times the URLs are found in that output file.
Any help will be appreciated.
Preethi
Below is my script:
use strict;
#use IO::Socket;
open (READ, "sample_scoff.txt"
my @scon_rd = <READ>;
open (WRITE, ">scon_wr.txt"
foreach my $line (@scon_rd) {
if ($line =~ m/^\d+/m )
{
my $num_line = $line;
#print "$num_line";
if ($num_line =~ m/\s(http.*?)\s/mg)
{
print "$1 \n\n";
}
}
close (READ);
}
open (ATon, "scon_wr.txt"
my @ATwr = <ATon>;
.................??????????
close (WRITE);
close (ATon);