johnkerl / miller

Miller is like awk, sed, cut, join, and sort for name-indexed data such as CSV, TSV, and tabular JSON
https://miller.readthedocs.io
Other
9.02k stars 217 forks source link

How to exit like awk? #341

Open amitbha opened 4 years ago

amitbha commented 4 years ago

I want to exit miller in some conditions, without processing remaining records. Just like awk's exit statement. ex. mlr put 'if ($month < 5) { exit 0 }; ....' Not found in document.

The Assertions could be a alternative to exit, but they only support type-check, not value.

johnkerl commented 4 years ago

Should we still execute the end blocks (if any) in the put statement? For example if there are 1000 records in the input data and you did exit(0) on the 17th one.

johnkerl commented 4 years ago

... aha, it should be awk-like in this regard too :)

https://www.gnu.org/software/gawk/manual/html_node/Exit-Statement.html