Can't you do it with awk instead? :: -----Original Message----- :: From: owner-nznog(a)list.waikato.ac.nz :: [mailto:owner-nznog(a)list.waikato.ac.nz] On Behalf Of Dean Pemberton :: Sent: Tuesday, 29 May 2001 12:39 :: To: nznog(a)list.waikato.ac.nz :: Subject: Re: New improved prefix list :) :: :: :: Seeings as more people are getting them, I thought it might :: be helpful to write this. :: :: :: #!/usr/bin/perl :: $cli = 0; :: $header = 0; :: while (<>) { :: chomp; :: ($crap,$crap,$name,$crap,$crap,$crap,$prefix,$le,$limit) :: = split (/\ /,$_); :: if (!$header) { :: if ($cli){ :: print "edit policy-options policy-statement $name\n"; :: }else{ :: print "policy-statement ihug-networks {\n\tterm :: accept {\n\t\tfrom {\n"; :: } :: $header = 1; :: } :: if ($cli) { :: print "set term accept from "; :: }else{ :: print "\t\t\t"; :: } :: print "route-filter $prefix "; :: if ($le eq "le") {print "upto /$limit";}else{print "exact";} :: if ($cli) { :: print "\n"; :: }else{ :: print ";\n"; :: } :: } :: if ($cli) { :: print"set term accept then accept\nset term reject then :: reject\n"; :: } else { :: print "\t\t}\n\t\tthen accept;\n\t}\n\tterm reject :: {\n\t\t\tthen reject;\n\t}\n}\n"; :: } :: :: :: output looks like this :: :: edit policy-options policy-statement ihug-networks :: set term accept from route-filter 202.36.94.0/23 upto /24 :: set term accept from route-filter 202.37.129.0/24 exact :: set term accept from route-filter 202.37.136.0/24 exact :: set term accept from route-filter 202.37.182.0/24 exact :: set term accept from route-filter 202.37.194.0/24 exact :: set term accept from route-filter 202.49.59.0/24 exact :: set term accept from route-filter 202.49.88.0/23 upto /24 :: set term accept from route-filter 202.49.148.0/23 upto /24 :: set term accept from route-filter 202.49.176.0/23 upto /24 :: set term accept from route-filter 202.49.180.0/23 upto /24 :: set term accept from route-filter 202.49.186.0/24 exact :: set term accept from route-filter 202.49.240.0/22 upto /24 :: set term accept from route-filter 202.49.249.0/24 exact :: set term accept from route-filter 202.49.252.0/22 upto /24 :: set term accept from route-filter 202.50.84.0/24 exact :: set term accept from route-filter 202.50.103.0/24 exact :: set term accept from route-filter 202.50.255.0/24 exact :: set term accept from route-filter 203.109.128.0/17 upto /24 :: set term accept from route-filter 203.173.128.0/17 upto /24 :: set term accept from route-filter 210.55.184.0/24 exact :: set term accept from route-filter 210.55.203.0/24 exact :: set term accept from route-filter 210.55.248.0/21 upto /24 :: set term accept then accept :: set term reject then reject :: :: or this :: :: policy-statement ihug-networks { :: term accept { :: from { :: route-filter 202.36.94.0/23 upto /24; :: route-filter 202.37.129.0/24 exact; :: route-filter 202.37.136.0/24 exact; :: route-filter 202.37.182.0/24 exact; :: route-filter 202.37.194.0/24 exact; :: route-filter 202.49.59.0/24 exact; :: route-filter 202.49.88.0/23 upto /24; :: route-filter 202.49.148.0/23 upto /24; :: route-filter 202.49.176.0/23 upto /24; :: route-filter 202.49.180.0/23 upto /24; :: route-filter 202.49.186.0/24 exact; :: route-filter 202.49.240.0/22 upto /24; :: route-filter 202.49.249.0/24 exact; :: route-filter 202.49.252.0/22 upto /24; :: route-filter 202.50.84.0/24 exact; :: route-filter 202.50.103.0/24 exact; :: route-filter 202.50.255.0/24 exact; :: route-filter 203.109.128.0/17 upto /24; :: route-filter 203.173.128.0/17 upto /24; :: route-filter 210.55.184.0/24 exact; :: route-filter 210.55.203.0/24 exact; :: route-filter 210.55.248.0/21 upto /24; :: } :: then accept; :: } :: term reject { :: then reject; :: } :: } :: :: depending on the value of $cli :: :: Apologies for the ugly perl - just hacked it up - feel free :: to make it pretty and rerelease. :: Also check the output before you apply it - It's your :: responsibility remember =) :: :: :: :: :: On Tue, May 29, 2001 at 09:52:11AM +1200, David Robb wrote: :: > Now with free steak knives! [1] :: > :: > As you can see, these allow for variable masks. If anyone requires :: > specific prefixes, let me know and I'll see what I can do. :: We change them :: > from time to time, and its easier this way. :: > :: > [1] Ok, I was kidding about the steak knives. :: > :: > :: > :: > --------- :: > To unsubscribe from nznog, send email to :: majordomo(a)list.waikato.ac.nz :: > where the body of your message reads: :: > unsubscribe nznog :: --------- :: To unsubscribe from nznog, send email to majordomo(a)list.waikato.ac.nz :: where the body of your message reads: :: unsubscribe nznog :: :: --------- To unsubscribe from nznog, send email to majordomo(a)list.waikato.ac.nz where the body of your message reads: unsubscribe nznog