Removing large files; adding hook to watch for them

This commit is contained in:
2022-12-18 22:14:25 -06:00
parent a34c96df6b
commit 0626c66413
29 changed files with 19 additions and 1740 deletions

View File

@@ -17,10 +17,11 @@ function findBadTerm() {
# param term: the term to search for duplicates
file="$1"
term="$2"
results="$(grep "$term:" "$file" | sed 's/\s\+'"$term"':\s*//' | sort)"
results="$(grep -i "$term:" "$file" | tr '[[:upper:]]' '[[:lower:]]' | sed 's/\s+'"$term"':\s*//' | sort | uniq -c | grep -vE '^\s+1\s+' )"
if ! diff <(echo "$results") <(echo "$results" | uniq); then
echo "Some ${term^^} entries are duplicated. Search for the above terms in your inventory and deduplicate."
if [ -n "$results" ]; then
echo "Some ${term} entries are duplicated. Search for the above terms in your inventory and deduplicate."
echo "$results"
exit 2
fi
}