01 | GREP
De FortiGate CLI biedt een ingebouwde versie van het grep-commando waarmee je output efficiƫnt kunt filteren.
GREP | Opties
Usage: grep [-invfcABC] PATTERN
Options:
-i Ignore case distinctions
-n Print line number with output lines
-v Select non-matching lines
-f Print fortinet config context
-c Only print count of matching lines
-A Print NUM lines of trailing context
-B Print NUM lines of leading context
-C Print NUM lines of output context
GREP | Simpele query
MetJeeen simpele GREP query kan ookje zien of de waarde voor komt in de config
LNNLROSEBFW001 (JP) # show sys int | grep VLAN2001
edit "VLAN2001"
GREP | Configuratie blok query
Door middel van de -f flag kan je de volledige config zien van waar de waarde in voor komt
LNNLROSEBFW001 (JP) # show sys int | grep -f VLAN2001
config system interface
edit "VLAN2001" <---
set vdom "JP"
set ip 10.20.1.254 255.255.255.0
set alias "Intern VLAN"
set device-identification enable
set monitor-bandwidth enable
set role lan
set interface "ae1"
set vlanid 2001
next
end
GREP | Meerdere waardes
Door middel van '<waarde1>\|<waarde2>' kan je meerdere waardes filterenopvragen, ophierbij dezekan manier:je uiteraard ook weer de -f flag gebruiken
LNNLROSEBFW001 (JP) # show systemsys interfaceint | grep 'VLAN4000\VLAN2001\|VLAN4001'
MaakVLAN2002'
bijedit meerdere"VLAN2001"
waardesedit gebruik"VLAN2002"
de
aan