Created
February 18, 2024 18:27
-
-
Save BlackthornYugen/3033e74a2290c16e82060f7267f94659 to your computer and use it in GitHub Desktop.
Check for files that were not coppied twice.
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 --raw-output --raw-input --slurp ' | |
split("\n") | | |
map(select(. != "") | capture("^(?<date>[\\d\\-]+\\s[\\d:]+),[\\d]+.*? (?<filename>[^:]+): (?<operation>Copied|Deleted)")) | | |
group_by(.filename) | | |
map({ | |
filename: .[0].filename, | |
copy_count: map(select(.operation == "Copied")) | length, | |
delete_date: map(select(.operation == "Deleted") | .date)[0] | |
}) | | |
map(select(.copy_count != 2))[] | [.delete_date, .filename, .copy_count] | @csv' < file-operations.log | tr -d '"' | column -t -s ',' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment