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.pngCheers


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.pngCheers