Support Forum
The Forums are a place to find answers on a range of Fortinet products from peers and product experts.
mulbzh
New Contributor III

Delete addresses objects in CLI

hello and sorry for my english,

 

I want in CLI mode delete all addresses objects that begin with particular name : 'Block-IP'

 

I know i can delete objects in config firewall address but how to do mass deletion with begin name ?

 

it is in config firewall address

 

thanks a lot

 

 

7 REPLIES 7
funkylicious
SuperUser
SuperUser

hi,

i dont think it's possible to do so in a mass way, meaning deleting all objects starting with Block-IP*, rather deleting them 1 by 1 .

from the GUI on the other hand you could do so by filtering the objects and then multiple selection.

"jack of all trades, master of none"
"jack of all trades, master of none"
mulbzh
New Contributor III

i don't want to do it in GUI but only in CLI script because it will be script in automation use every week

funkylicious

if you script it, then do a show firewall address | grep Block-IP and then line by line do a delete of the object name found with it.

"jack of all trades, master of none"
"jack of all trades, master of none"
mulbzh
New Contributor III

Ok, this commande works : show firewall address | grep Block-IP

 

but after how to delete line by line in CLI ?

 

 

funkylicious

after you get all the objects containing that string, e.g. Block-IP-1.1.1.1 , Block-IP-2.2.2.2 you would need to parse the output and for each line/object do a delete <> under config firewall address

"jack of all trades, master of none"
"jack of all trades, master of none"
mulbzh
New Contributor III

i understand this but how to store data of show firewall address | grep Block-IP command before send to delete command ?

funkylicious

you save the output of the command in a list and then parse it line by line.

that's how i would do it.

"jack of all trades, master of none"
"jack of all trades, master of none"
Announcements
Check out our Community Chatter Blog! Click here to get involved
Labels
Top Kudoed Authors