T
Truthless
Hello All,
I am new to perl however I have a decent knowledge of scripting in
general. I am trying (in the name of science) to convert a bash script I
had writen into a cgi script. This script searches mail log files for
sending relays.
Using a series of loops and regex I am able to extract the the data I
want from the log. The only thing that is holding me up is that I want
to count the number of occurance of individual matchs.
The follwing is part of the code I am working with:
sub findrelay{
if ($_[0]=~ /relay=(.*)\s/){
print "$1\n";
}
}
This will print out all the the text after relay= in my sendmail log. I
want to be able to count the number of occurances of all individual
relays. I am not certaian in which direction to go. Could someone please
offer suggestions on how this is done. I found it easy with the grep,
uniq and sort commands in bash. I am basicaly looking for the equivilant
of uniq -c | sort -r any help would be greatly appriciated.
Thanks in advance,
T.
I am new to perl however I have a decent knowledge of scripting in
general. I am trying (in the name of science) to convert a bash script I
had writen into a cgi script. This script searches mail log files for
sending relays.
Using a series of loops and regex I am able to extract the the data I
want from the log. The only thing that is holding me up is that I want
to count the number of occurance of individual matchs.
The follwing is part of the code I am working with:
sub findrelay{
if ($_[0]=~ /relay=(.*)\s/){
print "$1\n";
}
}
This will print out all the the text after relay= in my sendmail log. I
want to be able to count the number of occurances of all individual
relays. I am not certaian in which direction to go. Could someone please
offer suggestions on how this is done. I found it easy with the grep,
uniq and sort commands in bash. I am basicaly looking for the equivilant
of uniq -c | sort -r any help would be greatly appriciated.
Thanks in advance,
T.