https://serverfault.com/questions/70939/how-to-replace-a-text-string-in-multiple-files-in-linux
https://serverfault.com/questions/228733/how-to-rename-multiple-files-by-replacing-word-in-file-name
https://serverfault.com/questions/212153/replace-string-in-files-with-certain-file-extension
https://serverfault.com/questions/33158/searching-a-number-of-files-for-a-string-in-linux
These mentioned articles have all answered my question. However none of them work for me. I suspect it is because the string I am trying to replace has a # in it. Is there a special way to address this?
I have image file that had an é replaced by #U00a9 during a site migration. These look like this:
Lucky-#U00a9NBC-80x60.jpg
Lucky-#U00a9NBC-125x125.jpg
Lucky-#U00a9NBC-150x150.jpg
Lucky-#U00a9NBC-250x250.jpg
Lucky-#U00a9NBC-282x232.jpg
Lucky-#U00a9NBC-300x150.jpg
Lucky-#U00a9NBC-300x200.jpg
Lucky-#U00a9NBC-300x250.jpg
Lucky-#U00a9NBC-360x240.jpg
Lucky-#U00a9NBC-400x250.jpg
Lucky-#U00a9NBC-430x270.jpg
Lucky-#U00a9NBC-480x240.jpg
Lucky-#U00a9NBC-600x240.jpg
Lucky-#U00a9NBC-600x250.jpg
Lucky-#U00a9NBC.jpg
and I want to change it to something like this:
Lucky-safeNBC-80x60.jpg
Lucky-safeNBC-125x125.jpg
Lucky-safeNBC-150x150.jpg
Lucky-safeNBC-250x250.jpg
Lucky-safeNBC-282x232.jpg
Lucky-safeNBC-300x150.jpg
Lucky-safeNBC-300x200.jpg
Lucky-safeNBC-300x250.jpg
Lucky-safeNBC-360x240.jpg
Lucky-safeNBC-400x250.jpg
Lucky-safeNBC-430x270.jpg
Lucky-safeNBC-480x240.jpg
Lucky-safeNBC-600x240.jpg
Lucky-safeNBC-600x250.jpg
Lucky-safeNBC.jpg
UPDATE:
These examples all start with "LU00a9ucky but here are many images with different names. I am simply targeting the "#U00a9" portion of the string to replace with "safe".
rename
command. I suspect your rename would be as simple asrename -n 's/#/safeNBC/' *.jpg
.rename -n 's/#U00a9/safe/' *.jpg
and the command was accepted but no changes occurred.-n
is theno act
option. Which lets you see if it works before you actually use it. Did the output on the screen show the potential new names correctly?