I am assuming you want all and in this case I am just printing them. You could
push on to an array or create a hash:
#!perl -w
my $in = 0;
while ( <DATA> ) {
chomp;
$in++;
while ( /\s((\d{1,3}\.){3}\d{1,3})/g ) {
printf "ln: %5d $1\n", $in;
}
print "\n";
}
__DATA__
15:46:25.967683 194.244.46.38.1412 > 207.88.221.53.119: . ack 1115 win 8760 (DF)
15:46:26.600505 194.244.46.38.1412 > 207.88.221.53.119: P 15:21(6) ack 1115 win 8760
(DF)
15:46:26.600972 194.244.46.38.1412 > 207.88.221.53.119: F 21:21(0) ack 1115 win 8760
(DF)
15:46:26.604361 194.244.46.38.1412 > 207.88.221.53.119: R 14048899:14048899(0) win 0
(DF)
15:46:26.822313 207.88.221.53.119 > 194.244.46.38.1412: . ack 22 win 24820 (DF)
^--End of code
Output:
ln: 1 194.244.46.38
ln: 1 207.88.221.53
ln: 2 194.244.46.38
ln: 2 207.88.221.53
ln: 3 194.244.46.38
ln: 3 207.88.221.53
ln: 4 194.244.46.38
ln: 4 207.88.221.53
ln: 5 207.88.221.53
ln: 5 194.244.46.38
Wags ;)
-----Original Message-----
From: walter valenti [mailto:[EMAIL PROTECTED]]
Sent: Friday, September 21, 2001 07:53
To: [EMAIL PROTECTED]
Subject: reg expr
How i can write a reg. expr for find the IP address in log file like:
15:46:25.967683 194.244.46.38.1412 > 207.88.221.53.119: . ack 1115 win
8760 (DF)
15:46:26.600505 194.244.46.38.1412 > 207.88.221.53.119: P 15:21(6) ack
1115 win 8760 (DF)
15:46:26.600972 194.244.46.38.1412 > 207.88.221.53.119: F 21:21(0) ack
1115 win 8760 (DF)
15:46:26.604361 194.244.46.38.1412 > 207.88.221.53.119: R
14048899:14048899(0) win 0 (DF)
15:46:26.822313 207.88.221.53.119 > 194.244.46.38.1412: . ack 22 win
24820 (DF)
P.S. A IP address is: x.y.z.w where x, y, z, w are numbers of one,
two, three ciphers !!!
The 5th number visible in the log file is the port.
EX:
194.244.46.38 is IP address 1412 is the port
Thanks
Walter
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]