Hey all, need some assistance on this one. Greets to all and thanks in advance (long time no post)...
So I have the following in a file
But another instance might be
And I need this to print out this:
For each source address... Anyone care to help... This is what I started with...
Anyone? I'm completely lost.
perl -e 'print $i=pack(c5,(40*2),sqrt(7600),(unpack(c,Q)-3+1+3+3-7),oct(104),10,oct(101));'
So I have the following in a file
Code:
term permit_database_access {
from {
source-address {
aaa.aaa.aaa.aaa/32;
bbb.bbb.bbb.bbb/32;
ccc.ccc.ccc.ccc/32;
ddd.ddd.ddd.ddd/26;
eee.eee.eee.eee/32;
fff.fff.fff.fff/32;
ggg.ggg.ggg.ggg/32;
}
destination-port 12345;
}
then accept;
But another instance might be
Code:
term permit_other_database_access {
from {
source-address {
aaa.aaa.aaa.aaa/32;
bbb.bbb.bbb.bbb/32;
ccc.ccc.ccc.ccc/32;
}
destination-port 12345;
}
then accept;
And I need this to print out this:
Code:
ip access-list extended permit-other-database-access
permit aaa.aaa.aaa.aaa/32 any 12345
Code:
rulename=$(awk '/term/{gsub(/_/, "-");print $2}' filename)
awk -vrulename="$rulename" '
/source-address/{s=$1}
/destination-port/{d=$2}
/accept/{a=$2}
/reject/{r=$2}
{gsub(/;/, "");{printf "ip access-list extended" $rulename"\n\npermit ip" s,d,a}
' filename >> new.list
Anyone? I'm completely lost.
perl -e 'print $i=pack(c5,(40*2),sqrt(7600),(unpack(c,Q)-3+1+3+3-7),oct(104),10,oct(101));'