Skip to content

Instantly share code, notes, and snippets.

@ileathan
Last active October 27, 2023 03:28
Show Gist options
  • Save ileathan/6221817db51c816cb4f64035399baf12 to your computer and use it in GitHub Desktop.
Save ileathan/6221817db51c816cb4f64035399baf12 to your computer and use it in GitHub Desktop.
# 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