Thanks Peter with a little tinkering I was breezing along
Thanks to All
logger

-----Original Message-----
 From: Peter Eisengrein
To: 'logger'; [EMAIL PROTECTED]
Sent: 9/3/02 11:33 PM
Subject: RE: [Perl-unix-users] need some help in pattern 
matching

### UNTESTED

my $line = 'DNFAR1S query tli tcp /dev/tcp
\x00020bb8a9f3702f0000000000000000';
my @chunks = split(/\ /,$line);

# get the first 5 vars from @chunks

my ($v5,$h6,$ip1,$ip2,$ip3,$ip4) = $line =~
/^.(\w{4})(\w{4})(\w{2})(\w{2})(\w{2})(\w{2}).*/;
my $v6 = h2d($h6);
$ip1 = h2d($ip1);
$ip2 = h2d($ip2);
$ip3 = h2d($ip3);
$ip4 = h2d($ip4);

my $v7 = join('.',$ip1,$ip2,$ip3,$ip4);


sub h2d
{
         return unpack("i*",pack("h2",$_[0]));
}



>-----Original Message-----
> From: logger [ mailto:[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> ]
>Sent: Tuesday, September 03, 2002 13:17
>To: [EMAIL PROTECTED]
>Subject: [Perl-unix-users] need some help in pattern matching
>
>
>Hi All
>I have an entry like this in a file which I want to parse
>#comments1
>DNFAR1S query tli tcp /dev/tcp
>\x00020bb8a9f3702f0000000000000000
>#comments2
>PKG1S query tli tcp /dev/tcp \x000205c8a9f3702f0000000000000000
>and put into another file as different variables like
>#comments
>V1=DNFAR1S
>V2=query
>v3=tcp
>v4=/dev/tcp
>v5=0002
>v6=3000 // dec of 0bb8
>v7=169.43.112.47 // (a9f3702f converted to decimal )
>#comments2
>V1=
>.
>.
>v6=
>How do I match this pattern repeatedly so that I can create
>another file like this
>which also reproduces the comments
>
>Thanks for Reading through
>logger

__________________________________________________________
Give your Company an email address like
ravi @ ravi-exports.com.  Sign up for Rediffmail Pro today!
Know more. http://www.rediffmailpro.com/signup/

_______________________________________________
Perl-Unix-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to