Article 537W3 Script to scramble/randomise digits only in a file name

Script to scramble/randomise digits only in a file name

by
GPGAgent
from LinuxQuestions.org on (#537W3)
Hi Folks, You've all helped me loads to learn bash scripting but I've come across a problem I just don't know how to start

I want to scramble and possibly add a few more digits in a file name
Code:Fred - DATE 2020 - @fred 00145.v01.pngIn the above example I would like to scramble 00145.v01 into a random number at least of the same length which would be 9 digits.

so the new name would be
Code:Fred - DATE 2020 - @fred 032858300.pngThe numeric section does not always start at the same position on the file name, but does always have five digits followed by .v0

For example, the filenames could be like this
Code:Fred - DATE 2020 - @fred 00145.v01.png
Frederick - DATE 2020 - @fred 00145.v03.png
red - DATE - @fred 10145.v02.pngMaybe the script could have an additional parameter to define length of this new random set of digits, so if it set to say, 15 the new name would be
Code:Fred - DATE 2020 - @fred 032858300009534.pngCheerslatest?d=yIl2AUoC8zA latest?i=3zIry8Uo89U:gvqbTxVDt3w:F7zBnMy latest?i=3zIry8Uo89U:gvqbTxVDt3w:V_sGLiP latest?d=qj6IDK7rITs latest?i=3zIry8Uo89U:gvqbTxVDt3w:gIN9vFw3zIry8Uo89U
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments