Created
March 21, 2024 13:40
-
-
Save m-rey/7b5d794960ccc540b76025aa8b7f6275 to your computer and use it in GitHub Desktop.
short one liner to combine Redirector (Firefox extension) rule backups
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
jq -s '{ | |
"createdAt": (map(select(.createdAt != null) | .createdAt | .[:-5] + "Z" | fromdateiso8601) | max // now | strftime("%Y-%m-%dT%H:%M:%S.000Z")), | |
"createdBy": (max_by(.createdAt | .[:-5] + "Z" | fromdateiso8601) // {"createdBy": "Redirector"}).createdBy, | |
"redirects": (map(select(.redirects != null).redirects) | add) | |
}' Redirector*.json > combined_redirects.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment