RouterOS Command Line-Fu

I’m new to the routeros command line, but I find it much more pleasant to use than winbox/webfig, except for a few issues:

  • How do I add a line between some existing lines?
    For example: I have a jumplist with firewall rules and the last two lines are log and drop and I want to add a line before them. Now I add the line via ssh and then log into webfig where I reorder the lines.

  • How to operate on specific print results?
    I do /ip firewall filter print chain=input and see the results. There are 11 rules in the input chain and I want to remove line #4. If I do remove 4 it will remove the #4 from the list of all the chains.

Manual for you :wink:
http://wiki.mikrotik.com/wiki/Manual:Console

You can use “:put” to print very specific information:
http://wiki.mikrotik.com/wiki/Manual:Scripting

Thanks for pointing me to the manual as I apparently read it too quickly.

In case anyone comes to this post:
Print will assign the line numbers for the current session, so remove, move, add, … operate on the last print results. To add something before use add with place-before=#.

Thanks for the :put tip.