Last active
October 27, 2023 03:28
-
-
Save ileathan/6221817db51c816cb4f64035399baf12 to your computer and use it in GitHub Desktop.
This file contains 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
# USAGE: RetroArchRenameBoilerPoint.sh ./Nintendo\ -\ Nintendo\ Entertainment\ System.lp | |
IFS=$'\n' | |
for filename in $(cat "$1" | grep -oP '.*"path": ".*/\K.*\.[^"]*'); do | |
romname=$(echo $filename | perl -pe 's/([[\]()+\$^{}])/\\$1/g') | |
romname=$(cat "$1" | grep -zoP "(/|\\\)$romname"'",\s{7}\"label\": \"\K[^"]*') | |
romname=$(echo "$romname" | perl -pe 's/[&*\/:`<>?\|]/_/g') | |
if [[ "${filename:0:-4}" == "$romname" ]]; then | |
: | |
else | |
echo "$filenale != $newname" | |
fi | |
done | |
unset IFS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment