Created
December 28, 2021 04:44
-
-
Save lucmann/8a806fb3f9be74806aecdb8f28c44e40 to your computer and use it in GitHub Desktop.
rename files in bulk
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
find -name 'ARB-*.md' -printf '%P\n' | awk '{orig=$0; gsub(/-/, "_"); print "mv", orig, $0}' | bash | |
# notes | |
# | |
# -printf '%P\n' to strip preceding './' from find's output | |
# orig=$0 to save original file name | |
# gsub(/-/, "_") to subsititue '-' in the original file name to '_' in the target file name, it happens to '$0' in place | |
# print "mv", orig, $0 to generate shell command |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment