On Tue, May 29, 2001 at 12:56:02PM +1200, Juha Saarinen wrote:
Can't you do it with awk instead?
#!/usr/bin/awk -f BEGIN { # insert more stuff here if you have a test box to play with, or can # be bothered to go look at the manuals when you've drunk just enough # Niagra region chardonnay to start to think that it tastes half-decent trans["le"] = "upto"; } /^ip prefix-list [A-Za-z0-9-]+ permit [0-9\.]+\/[0-9]+/ && \ trans[$6] != "" && $7 ~ /[0-9]+/ { phrase[$3 ":" clauses[$3]++] = "route-filter " $5 " " trans[$6] " /" $7; next; } /^ip prefix-list [A-Za-z0-9-]+ seq [0-9]+ permit [0-9\.]+\/[0-9]+/ && \ trans[$8] != "" && $9 ~ /[0-9]+/ { phrase[$3 ":" clauses[$3]++] = "route-filter " $7 " " trans[$8] " /" $9; next; } /^ip prefix-list [A-Za-z0-9-]+ permit [0-9\.]+\/[0-9]+/ { phrase[$3 ":" clauses[$3]++] = "route-filter " $5 " exact"; } /^ip prefix-list [A-Za-z0-9-]+ seq [0-9]+ permit [0-9\.]+\/[0-9]+/ { phrase[$3 ":" clauses[$3]++] = "route-filter " $7 " exact"; } END { for (c in clauses) { printf "policy-statement %s {\n\tterm accept {\n\t\tfrom {\n", c; for (i = 0; i < clauses[c]; i++) printf "\t\t\t%s;\n", phrase[c ":" i]; printf "\t\t}\n\t\tthen accept;\n\t}\n\tterm reject {\n"; printf "\t\t\tthen reject;\n\t}\n}\n"; } } --------- To unsubscribe from nznog, send email to majordomo(a)list.waikato.ac.nz where the body of your message reads: unsubscribe nznog