Skip to content

Instantly share code, notes, and snippets.

@iexa
Last active October 31, 2022 05:00
Show Gist options
  • Save iexa/a9f15c59321dee9a5ad23f6c5eadc1d1 to your computer and use it in GitHub Desktop.
Save iexa/a9f15c59321dee9a5ad23f6c5eadc1d1 to your computer and use it in GitHub Desktop.
Test a QuickSFV file on OSX with md5 and pv for progress-bar
#!/bin/bash
# use cat md5-file | ./test-md5.sh
while IFS='' read -r line || [[ -n "$line" ]]; do
if [[ $line = *";"* ]]; then
continue
fi
path=${line#* \*}
path=${path%$'\r'}
path=${path/\\//}
expected=${line% *}
# calculated=$(md5 -q $path)
calculated=$(pv -- $path | md5 | sed 's/-$//' | printf '%s%s\n' "$(cat -)")
if [ "$expected" = "$calculated" ]; then
echo "$path: ✔"
else
echo "$path: ✖ $expected|$calculated"
fi
done
@iexa
Copy link
Author

iexa commented Oct 31, 2022

install pv with (home)brew first

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment