Last active
July 13, 2017 18:01
-
-
Save sloanlance/e255f15618221af15cd57ac3f55f8aba to your computer and use it in GitHub Desktop.
jq, JSONL: Use jq's `--slurp` option to treat JSONL as a JSON array, then sort it
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -- | |
# Execute with an argument containing the name of the property to be | |
# used for sorting. | |
# Improved according to a suggestion from @pkoppstein in response to my | |
# support issue: | |
# https://github.com/stedolan/jq/issues/1447#issuecomment-314918635 | |
jq --slurp --compact-output 'sort_by(.'${1}')[]' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See jq issue: jqlang/jq#1447