Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Adding object identifiers corresponding to each IP and printing them to O/P File.

by Melly (Hermit)
on Jan 10, 2007 at 19:22 UTC ( #593987=note: print w/ replies, xml ) Need Help??


in reply to Adding object identifiers corresponding to each IP and printing them to O/P File.

Please show some code (or offer to pay someone). The task is fairly trivial - a combination of regexs and hashes will do it - btw one thing I remain slightly puzzled over is where the '|5|2|6' type values come from...

map{$a=1-$_/10;map{$d=$a;$e=$b=$_/20-2;map{($d,$e)=(2*$d*$e+$a,$e**2 -$d**2+$b);$c=$d**2+$e**2>4?$d=8:_}1..50;print$c}0..59;print$/}0..20
Tom Melly, pm@tomandlu.co.uk


Comment on Re: Adding object identifiers corresponding to each IP and printing them to O/P File.
Download Code
Re^2: Adding object identifiers corresponding to each IP and printing them to O/P File.
by Kiran Kumar K V N on Jan 11, 2007 at 12:58 UTC

    Hi All,

    I) In the File Test, we have the following with the IP 8.2.0.4352.1.1 as one of the data component in each of the following 3 complete headers:-

    1) |8.2.0.4352.1.1|8.2.0.4352.1.1|0x3|10|2|105|36242050|58

    2) |8.2.0.4352.1.1|8.2.0.4352.1.1|0x3|11|2|238|36241618|40

    3) |8.2.0.4352.1.1|8.2.0.4352.1.1|0x3|14|6|3|97.232.1.2|6

    II) In the File Test1, we have the following with the same IP i.e. 8.2.0.4352.1.1 as one of the data component in each of the following 3 complete headers:-

    1) |8.2.0.4352.1.1|8.2.0.4352.1.1|0x3|10|2|141|33554850|58

    2) |8.2.0.4352.1.1|8.2.0.4352.1.1|0x3|11|2|250|38928802|40

    3) |8.2.0.4352.1.1|8.2.0.4352.1.1|0x3|14|6|3|97.232.1.2|6

    i) Now the first purpose is to compare both the Files for matched headers. When we compare both the Files, we see that only the header |8.2.0.4352.1.1|8.2.0.4352.1.1|0x3|14|6|3|97.232.1.2|6, matches completely or is common in both the Files.

    The above matched header i.e.|8.2.0.4352.1.1|8.2.0.4352.1.1|0x3|14|6|3|97.232.1.2|6,in the first File i.e. Test, has the following 6 objects(may be n objects also) :-

    |7|1|1553

    |7|2|13

    |7|3|1870

    |5|4|0

    |7|5|22087238

    |7|6|73162814

    Similarly in second File i.e. Test1, the same header has the following 6 objects (may be n objects also) :-

    |7|1|1545

    |7|2|14

    |7|3|1981

    |5|4|0

    |7|5|18613745

    |7|6|81837527

    ii) Now the second purpose is to add the identifiers of objects (ignoring the 1st and 2nd place identifiers which are always common and adding only the identifiers at the 3rd place), corresponding to each IP like the following:-

    |7|1|1553 + |7|1|1545 = |7|1|3098

    |7|2|13 + |7|2|14 = |7|2|27

    |7|3|1870 + |7|3|1981 = |7|3|3851

    |5|4|0 + |5|4|0 = |5|4|0

    |7|5|22087238 + |7|5|22087238 = |7|5|44174476

    |7|6|73162814 + |7|6|81837527 = |7|6|155000341

    iii) Third purpose is to print the new output in an Output File Test_Output.

    iv) Now this comparison and addition operation is time bound. Now the fourth purpose is to check that these 2 operations should occur every 30 mins like an Audit.

    Please give your very valuable Inputs.

    Thanks and Regards,

    KiranKumar K.

      You still don't explain where, e.g. |7|1|1553, comes from - I can't see those values in the input files. You refer to them as 'objects', but I have no idea what that means in this context...

      Can you please explain how you derive these values - I might then be tempted to offer some help (although I will not write you a complete solution).

      You would do a lot better if you at least posted some sort of attempt at coding this.

      map{$a=1-$_/10;map{$d=$a;$e=$b=$_/20-2;map{($d,$e)=(2*$d*$e+$a,$e**2 -$d**2+$b);$c=$d**2+$e**2>4?$d=8:_}1..50;print$c}0..59;print$/}0..20
      Tom Melly, pm@tomandlu.co.uk

        Hi Melly,

        Object or Message Object is data (in the Form |7|1|1553) in a Packet(a Networking Term). For eg:- |7|1|1553 is one Object. Similarly |7|5|18613745 is another Object and so on.

        Identifier is one of the component in the Message Object. For eg:- in the Object |7|1|1553, 7 is the first identifier, 1 is the second identifier and 1553 is the third identifier.

        There are 'N' number (N being a real number) of Message Objects (I have mentioned just 6) under the header in each of the 2 Files i.e. Test and Test1.

        Both these Files are Log Files which are already given to the user and the complete data format in both Files will look like as below :-

        1) In File 'Test' :-

        #LOGNUM|1|OPERATIONAL

        |O%:CCLN-1-CBS1

        |8.2.0.4352.1.1|8.2.0.4352.1.1|0x3|14|6|3|97.232.1.2|6

        |7|1|1553

        |7|2|13

        |7|3|1870

        |5|4|0

        |7|5|22087238

        |7|6|73162814

        : :

        : :

        and so on ....

        2) In File 'Test1' :-

        #LOGNUM|1|OPERATIONAL

        |O%:CCLN-1-CBS1

        |8.2.0.4352.1.1|8.2.0.4352.1.1|0x3|14|6|3|97.232.1.2|6

        |7|1|1545

        |7|2|14

        |7|3|1981

        |5|4|0

        |7|5|18613745

        |7|6|81837527

        : :

        : :

        and so on....

        ii) Our purpose is to add the identifiers of objects (ignoring the 1st and 2nd place identifiers which are always common and adding only the identifiers at the 3rd place), corresponding to each matched header like the following:-

        |7|1|1553 + |7|1|1545 = |7|1|3098

        |7|2|13 + |7|2|14 = |7|2|27

        |7|3|1870 + |7|3|1981 = |7|3|3851

        |5|4|0 + |5|4|0 = |5|4|0

        |7|5|22087238 + |7|5|22087238 = |7|5|44174476

        |7|6|73162814 + |7|6|81837527 = |7|6|155000341

        The rest of the details, I have already explained in my previous posting.

        Request you to please give your very valuable Inputs.

        Thanks and Regards,

        KiranKumar K.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://593987]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (8)
As of 2014-11-28 11:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (196 votes), past polls