I think it would be convenient, if we were able to stop the filter command from sending filtered lines to the specified alias when using the -k flag. Let me try to illustrate what I mean:
//filter -fk
versions.txt myalias *var*
alias myalias {
; incoming line $1
inc %total
if (%total == 10) {
; we are satisfied with our filtered matches, and don't need the remaining lines to be sent to the alias
; /stopfilter
}
else {
; processing
}
}
Currently, the only thing we can do is make the alias return immediately if we have already met our global condition, something like:
alias myalias {
if (%total == 10) return
inc %total
; processing
}
or
alias myalias {
if (%total < 10) {
inc %total
; processing
}
}
However, there is overhead in this, in that filter keeps calling the alias for each filtered line, until all lines are processed. I wish it were possible to stop filtering in the middle of a filter.