-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filter inputs away #5
Comments
would do what you want. You should probably use the (sadly undocumented) builtin function
I intentionally didn't implement if-without-else, since I'm not sure whether the best default for "else" behaviour is produce-no-output or dont-change-the-input (that is, whether the implicit else block should be |
Ah. Brilliant. I don't think there's any need for if-without-else in the presence of select and empty. Closing this ticket because there's no issue with jq, just a gap in the docs. Cheers. |
I might well be reading the docs wrong, but I don't think there's a way to perform the following operation. Given the input
Get only the objects where
.foo == "bar"
, resulting in the output:Currently the syntax for conditionals, requires an else case. If this were changed to allow only an if case and to not output a value if the case that doesn't match then the program which supplies the above could be:
My current work around involves using the else case to output a sentinel value which I grep away before piping back into jq again.
The text was updated successfully, but these errors were encountered: