freebsd-ports/net-mgmt/ssgless/files/lesspipe-ssg.awk.in
Baptiste Daroussin d13c52e63e Viewer configuration files of devices with ScreenOS
(of Juniper Networks), considers the context of commands.

				For example to:
set vrouter trust-vr sharable
set vrouter "trust-vr"
unset auto-route-export
set protocol ospf
set enable
exit
exit
unset alg sip enable
				and after:
set vrouter trust-vr sharable
set vrouter "trust-vr"
   unset auto-route-export
   set protocol ospf
      set enable
   exit
exit
unset alg sip enable

PR:		ports/162676
Submitted by:	Pavel I Volkov
2012-05-15 13:02:18 +00:00

17 lines
566 B
Awk

#!%%AWK%% -f
BEGIN { count=1 }
/^set anti-spam profile [^[:space:]]+\r?$/ ||
/^set av profile [^[:space:]]+\r?$/ ||
/^set vrouter [^[:space:]]+\r?$/ ||
/^set protocol bgp/ ||
/^set protocol ospf\r?$/ ||
/^set protocol pim\r?$/ ||
/^set protocol rip\r?$/ ||
/^set crypto-policy\r?$/ ||
/^set sctp configuration aaa\r?$/ ||
/^set policy id [[:digit:]]+\r?$/ ||
/^set url protocol [^[:space:]]+\r?$/ ||
/^set route-map name / { out($0,count); count++; next }
/^exit\r?$/ { count-- }
{ out($0,count) }
function out(s,c) { for(i=1; i<c; i++) printf("%s","\t"); print s }