script export leases ,, help,, [SOLVED]

I need a script, that I can export to a text file, the following of the leases of the dhcp-

The text file I just want to show me Comment, rate-limit, dhcp-server, today from the console I export everything and I just need what I said above
Thank you

Cut and past this to your console:

[
/ip dhcp-server lease
:foreach i in=[find] do={
: put "$[get value-name=comment $i] $[get value-name=rate-limit $i] $[/system identity get name] $[/system clock get date]"
}
]

It will give you DHCP_comment, DHCP_rate-limit, Identity name and current date.

thank you, it worked perfect,


forgive the boldness, and to save the result of a text file? What should be added?

Not sure, seems to only save first line when I use file directly.
Maybe store all to array and then save to file.

Someone other care to help?