Skip to content

Instantly share code, notes, and snippets.

@megawertz
Created February 16, 2022 21:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save megawertz/b2b6075f8343f081a2b2e831bc953a02 to your computer and use it in GitHub Desktop.
Save megawertz/b2b6075f8343f081a2b2e831bc953a02 to your computer and use it in GitHub Desktop.
Command to remove Blackboard name additions from uploaded files.
# This works fine
for f in *.java; do i=$(echo $f | awk -F "_" '{print $5}'); mv "$f" $i; done
# Can also do this with awk's system command. Trying to work around spaces was quite the adventure here.
# https://unix.stackexchange.com/questions/148454/how-to-escape-spaces-etc-in-passed-variable-for-system-call-to-cp-in-awk
find . -name "*.java" -exec echo '{}' \; | awk -F "_" '{system("echo '\''" $0 "'\'' " $5)}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment