Bryan Irvine wrote:
>
> [EMAIL PROTECTED] wrote:
> >
> > Assuming there is only one set of brackets on a line, and you only
> > want the IP address between them, and READLOG is an open handle to
> > your log:
> >
> > - Not Tested -
> > my @ips;
> > while (my $line = ) {
> >if ($line =~ /\[(.*
This is what I came up with. Tested and works.
#!/usr/bin/perl -w
use strict;
open DATA, "ips.txt"; # this is the output file with the ip list
while () {
if ($_ =~ /\[(\w+\.\w+\.\w+\.\w+)\]/) {
print IPS "$1\n";
}
}
Chris Carver
Pennswoods.net
Mail Administrat
>
> Assuming there is only one set of brackets on a line, and you only want the IP
> address between them, and READLOG is an open handle to your log:
>
> - Not Tested -
> my @ips;
> while (my $line = ) {
>if ($line =~ /\[(.*)\]/) {
> push @ips, $1;
>}
>else {
> print STD
On 04 Aug 2003 14:08:29 -0700, Bryan Irvine <[EMAIL PROTECTED]> wrote:
> I'm trying to build a script to automagically black-list spammers. How
> can I extract the ip address from between [ ]?
>
> turn this:
>
> Received: from 24.60.195.149 (h0
]]
Sent: Tuesday, September 17, 2002 12:09 PM
To: Ian
Cc: [EMAIL PROTECTED]
Subject: Re: Extracting text from a phrase
That's because my match isn't matching anything. It's not very
forgiving and anything so much as a space or case change in the wrong
place could throw it off. Ca
That's because my match isn't matching anything. It's not very
forgiving and anything so much as a space or case change in the wrong
place could throw it off. Can you alter the match a little so it will
catch the actual lines?
James
On Tuesday, September 17, 2002, at 10:58 AM, Ian wrote:
Hi,
Thank you but when I try and run that by doing a
Perl script.pl file.shtml >newfile.txt
I am getting a blank output.
Sorry if I did not explain myself correctly.
There are multiple instances of this line in the one page, and I need to
generate a simple text file to use for another applica
Why not try grabbing all the important stuff right out of the pattern,
like my example below. Note: Your pattern may need changes if I
assumed too much, from your examples.
#!/usr/bin/perl
while (<>) {
if (m!([^<]+)!) {
print qq();
}
}
On Tuesday, September 17, 2002, at 10:05 AM, Ian wrote:
--
From: Janek Schleicher [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 03, 2002 3:10 PM
To: [EMAIL PROTECTED]
Subject: Re: extracting text
Charlie Farinella wrote at Wed, 03 Jul 2002 23:51:44 +0200:
> I have the following script that prints email addresses enclosed in <>
from a logf
Charlie Farinella wrote at Wed, 03 Jul 2002 23:51:44 +0200:
> I have the following script that prints email addresses enclosed in <> from a
>logfile. It works
> by removing everything up to and including the bracket on the left, and then doing
>the same on the
> right. I would like to be able
10 matches
Mail list logo