in reply to Generating a List of numbers
OK so I tried as many examples as I could. The one worked but i couldnt' quite do what i needed with it.
Looks like I am right back to square 1. So here is the test scenario that I made. I just need to know what I am doing wrong with my code.(i don't need a "better" way of doing it, unless a good justification can be justified)
this is the file "ip accounting file":
Source Destination Packets Bytes 15.254.32.120 10.2.9.2 5 504 63.97.127.34 10.2.9.2 4 471 17.149.36.162 10.2.9.3 14 3416 79.31.21.75 10.2.9.2 11 3993 209.68.19.130 10.2.9.2 33 15941 72.247.242.235 10.2.9.2 7 3750 17.149.36.15 10.2.9.3 14 3404 65.54.81.34 10.2.9.2 42 23068 67.148.147.64 10.2.9.2 553 274036 67.148.147.65 10.2.9.3 57 39207 8.8.8.8 10.2.9.6 84 8006 Accounting data age is 0w1d Box#
here is the file "include ip file" :
10.2.9.2 10.2.9.3 10.2.9.4 10.2.9.5 10.2.9.6
my code is this:
#!/usr/bin/perl -w open TMPINCLUDEIPFILE, "<", "$tmpincludeipfile"; open TMPIPACCOUNTINGFILE, "<", "$tmpipaccountingfile"; foreach $Line (<TMPINCLUDEIPFILE>) { print "Line = $Line\n"; foreach $Line1 (<TMPIPACCOUNTINGFILE>) { print "Line1 = $Line1\n"; } } exit;
and this code gives me the following output:
./testfile.pl Line = 10.2.9.2 Line1 = Source Destination Packets By +tes Line1 = 15.254.32.120 10.2.9.2 5 +504 Line1 = 63.97.127.34 10.2.9.2 4 + 471 Line1 = 17.149.36.162 10.2.9.3 14 + 3416 Line1 = 79.31.21.75 10.2.9.2 11 +3993 Line1 = 209.68.19.130 10.2.9.2 33 + 15941 Line1 = 72.247.242.235 10.2.9.2 7 + 3750 Line1 = 17.149.36.15 10.2.9.3 14 + 3404 Line1 = 65.54.81.34 10.2.9.2 42 230 +68 Line1 = 67.148.147.64 10.2.9.2 553 + 274036 Line1 = 67.148.147.65 10.2.9.3 57 + 39207 Line1 = 8.8.8.8 10.2.9.6 84 80 +06 Line1 = Line1 = Accounting data age is 0w1d Line1 = Box# Line = 10.2.9.3 Line = 10.2.9.4 Line = 10.2.9.5 Line = 10.2.9.6
The output I expected to see (looking for) is:
Is there something wrong with my code? if so, what? thanks in advance! MarcLine = 10.2.9.2 Line1 = Source Destination Packets By +tes Line1 = 15.254.32.120 10.2.9.2 5 +504 Line1 = 63.97.127.34 10.2.9.2 4 + 471 Line1 = 17.149.36.162 10.2.9.3 14 + 3416 Line1 = 79.31.21.75 10.2.9.2 11 +3993 Line1 = 209.68.19.130 10.2.9.2 33 + 15941 Line1 = 72.247.242.235 10.2.9.2 7 + 3750 Line1 = 17.149.36.15 10.2.9.3 14 + 3404 Line1 = 65.54.81.34 10.2.9.2 42 230 +68 Line1 = 67.148.147.64 10.2.9.2 553 + 274036 Line1 = 67.148.147.65 10.2.9.3 57 + 39207 Line1 = 8.8.8.8 10.2.9.6 84 80 +06 Line1 = Line1 = Accounting data age is 0w1d Line1 = Box# Line = 10.2.9.3 Line1 = Source Destination Packets By +tes Line1 = 15.254.32.120 10.2.9.2 5 +504 Line1 = 63.97.127.34 10.2.9.2 4 + 471 Line1 = 17.149.36.162 10.2.9.3 14 + 3416 Line1 = 79.31.21.75 10.2.9.2 11 +3993 Line1 = 209.68.19.130 10.2.9.2 33 + 15941 Line1 = 72.247.242.235 10.2.9.2 7 + 3750 Line1 = 17.149.36.15 10.2.9.3 14 + 3404 Line1 = 65.54.81.34 10.2.9.2 42 230 +68 Line1 = 67.148.147.64 10.2.9.2 553 + 274036 Line1 = 67.148.147.65 10.2.9.3 57 + 39207 Line1 = 8.8.8.8 10.2.9.6 84 80 +06 Line1 = Line1 = Accounting data age is 0w1d Line1 = Box# Line = 10.2.9.4 Line1 = Source Destination Packets By +tes Line1 = 15.254.32.120 10.2.9.2 5 +504 Line1 = 63.97.127.34 10.2.9.2 4 + 471 Line1 = 17.149.36.162 10.2.9.3 14 + 3416 Line1 = 79.31.21.75 10.2.9.2 11 +3993 Line1 = 209.68.19.130 10.2.9.2 33 + 15941 Line1 = 72.247.242.235 10.2.9.2 7 + 3750 Line1 = 17.149.36.15 10.2.9.3 14 + 3404 Line1 = 65.54.81.34 10.2.9.2 42 230 +68 Line1 = 67.148.147.64 10.2.9.2 553 + 274036 Line1 = 67.148.147.65 10.2.9.3 57 + 39207 Line1 = 8.8.8.8 10.2.9.6 84 80 +06 Line1 = Line1 = Accounting data age is 0w1d Line1 = Box# Line = 10.2.9.5 Line1 = Source Destination Packets By +tes Line1 = 15.254.32.120 10.2.9.2 5 +504 Line1 = 63.97.127.34 10.2.9.2 4 + 471 Line1 = 17.149.36.162 10.2.9.3 14 + 3416 Line1 = 79.31.21.75 10.2.9.2 11 +3993 Line1 = 209.68.19.130 10.2.9.2 33 + 15941 Line1 = 72.247.242.235 10.2.9.2 7 + 3750 Line1 = 17.149.36.15 10.2.9.3 14 + 3404 Line1 = 65.54.81.34 10.2.9.2 42 230 +68 Line1 = 67.148.147.64 10.2.9.2 553 + 274036 Line1 = 67.148.147.65 10.2.9.3 57 + 39207 Line1 = 8.8.8.8 10.2.9.6 84 80 +06 Line1 = Line1 = Accounting data age is 0w1d Line1 = Box# Line = 10.2.9.6 Line1 = Source Destination Packets By +tes Line1 = 15.254.32.120 10.2.9.2 5 +504 Line1 = 63.97.127.34 10.2.9.2 4 + 471 Line1 = 17.149.36.162 10.2.9.3 14 + 3416 Line1 = 79.31.21.75 10.2.9.2 11 +3993 Line1 = 209.68.19.130 10.2.9.2 33 + 15941 Line1 = 72.247.242.235 10.2.9.2 7 + 3750 Line1 = 17.149.36.15 10.2.9.3 14 + 3404 Line1 = 65.54.81.34 10.2.9.2 42 230 +68 Line1 = 67.148.147.64 10.2.9.2 553 + 274036 Line1 = 67.148.147.65 10.2.9.3 57 + 39207 Line1 = 8.8.8.8 10.2.9.6 84 80 +06 Line1 = Line1 = Accounting data age is 0w1d Line1 = Box#
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Generating a List of numbers
by GrandFather (Saint) on Feb 01, 2012 at 04:16 UTC | |
by mlebel (Hermit) on Feb 01, 2012 at 13:09 UTC | |
by GrandFather (Saint) on Feb 01, 2012 at 19:56 UTC | |
by GrandFather (Saint) on Feb 01, 2012 at 20:06 UTC | |
by aaron_baugher (Curate) on Feb 01, 2012 at 23:45 UTC |