I hereby request a feature which is really important in my opinion.
It should be possible to use sorting anywhere in the CLI. I don’t think “print where list=ABC” is a really good solution.
Address lists should be autosorted, so that entries from the same list are being printed continously, like Cisco access lists
BGP peers should be autosorted (Remote-AS, or IP, or Name), like Cisco does.
I think this is a really great and long-needed idea, as I prefer CLI over Winbox or the Web UI. Some sections should be definitely auto-sorted too - it doesn’t make sense to display address lists all mixed up instead of showing them consecutively. I think Mikrotik should settle with three different ways:
Auto-sorted entries like address lists, e.g. alphanumerically ascending (to keep the address lists together and make them easier to read), in case of address lists probably even first by name, then by IP address (lowest to highest IP for example)
Temporary sorting while printing configurations at various places, without affecting the entry permanently, e.g. print all IP addresses sorted by their comment, descending alphanumerically.
Permanent sorting, e.g. you can specify some options and the entries get permanently reordered
This should cover all use cases and would be a great addition. Configuration gets really hard to read when you have a lot of entries, e.g. many BGP peers or big address lists. And there’s not even manual moving, so you have to deal with it or export them, remove all entries and re-import… obviously not great for BGP.
It looks like all lists are auto-sorted, but unfortunately they are sorted by # (ID).
It would certainly be nice to be able to “order by fieldname,fieldname” in the CLI.
However, it looks like the sorting in Winbox and WebUI is done by the client.
RouterOS may not have the infrastructure to hold command output and sort it before sending to the user…
Remember that some commands produce a lot of output and can be paused for arbitrary time due to
pagination, so it can commit quite some router memory to pending sorted output.
it’s 2023 and this would be super useful. With the CRS series now out and support layer 3 hardware routing, things like the address lists are growing larger and larger.
Some sorting i would like to see by default.
Bridge VLAN list by vlan id, ascending.
Address list by address, ascending.
ip pools by pool name ascending.
There are probably more places this could be done. When configs are pushing hundreds of lines, i end up having to copy /export into a text editor and sorting there to gain better readability.
2024 and I’d still like this feature. Just done /file/print and wanted it sorted please. After all the GUI interface is sorted - sort of. It’s case-sensitive sort.
Surprisingly, never run into this need myself. But I can see some “sortby=” on a print be helpful.
One note is that the “print” is ordered by when they were added. While not ideal, you add (or remove+re-add) them in the order you’d to see later. Obviously, does not solve some generic ORDER BY.
Also far from ideal, but you could sort print at CLI, indirectly, using an array – since scripting arrays are sorted alphabetically by default. Jjust no good way to do “pretty” output.
I do work mostly in winbox because of its flexibility in things like… Sorting! I even use Winbox over Wine. But I’ve needed this feature on a handful of occasions and every time it’s been really painful. Today it was such an occasion had to look up a certificate to revoke it, didn’t know the exact name, was on my cell in the middle of a cocktail thing and found myself standing in a corner with a long face, waving people off while scrolling through pages of random data looking for that needle in a haystack.
I get it. It’s in Winbox. If you need this feature, use that. But there’s the once or twice situation where you really need this, and it’s really painful. And as others mentioned, there are still some keyboard warriors out there that use the cli exclusively.