in reply to Comparing lines in txt.file

Please post your data, the code you have tried, and the results of your code's execution (within <code></code> tags), so we can better assist you.

Replies are listed 'Best First'.
Re^2: Comparing lines in txt.file
by zakishah (Novice) on Aug 16, 2012 at 03:28 UTC

    Well as far as code is concerned i cant make sense of it how to write that is why i seek help here and as far as my data is concerned i have already given in my first question the tracroute result where i have to match ip address in each line. once again trace route table is given below i want to check if ip address of line and the line before previous line are same it should display warning msg that says " routing loop". thanks for help

    1 10.0.0.110 (10.0.0.110) 0.449 ms 0.353 ms 0.385 ms 2 10.0.0.109 (10.0.0.109) 0.367 ms 0.355 ms 0.412 ms 3 10.0.0.110 (10.0.0.110) 0.660 ms 0.669 ms 0.644 ms 4 10.0.0.109 (10.0.0.109) 0.794 ms 0.702 ms 0.665 ms 5 10.0.0.110 (10.0.0.110) 1.113 ms 1.010 ms 0.997 ms 6 10.0.0.109 (10.0.0.109) 1.039 ms 0.997 ms 1.001 ms

      I don't want to be rude, but you said this is for an assignment. If you don't know Perl well enough to even try something that we can help you with, then you probably need to go back to the beginning and start over. If we just give you the solution, that may satisfy your teacher/boss this time, but you'll be even further behind for the next assignment.

      This is a pretty straightforward task: read the lines, parsing out the IP addresses and saving them to a hash, checking to see if they already exist as a hash key and alerting if one does. The parsing could be done with split or a regex (I'd vote for split here). All pretty basic Perl stuff.

      Aaron B.
      Available for small or large Perl jobs; see my home node.

        Thank you very much you are very right i tried many perl tutorials but time is important factor which pushed me to seek help here i would be very glad if you give me solution along with explaination that can boost my knowledge too. Thanks