Hello,
I need to know how to rename a bunch of files i have.
All the files are currently in the same format and I need to do 3 things to the name. First I need to add a leading W to the name, then where the name ends with the extention .dwg i need to make this uppercase (.DWG) and the 3rd thing is I need to add a leading 0 to part of the name.
All the files are in the same format.
Here is an example of a filename i have.
21-11-000-01-103-01.dwg
All the files are similar to this and in the same format of two digits a dash, two more digits, a dash, 3 digits, a dash....etc.. just like the example above. Also they all end with .dwg.
What I need is for this filename to look like this
W21-11-00-01-103-01.DWG
So, the filename needs a leading W to go before the original filename. The 3rd set of digits (the -000) would need to become -00 (cut off the leading digit) and then the .dwg would need to become .DWG.
One more example would be
54-21-061-50-125-30.dwg
Would become:
W54-21-61-50-125-30.DWG
I would appreciate any help with this. I do not know much about shell scripting and I need to do this kind of stuff sometimes. I'm not sure if it would be better to do this in several steps with several scripts..or all together..but..I would really appreciate anybody that would know how to do this.
Thanks
Johnny
I need to know how to rename a bunch of files i have.
All the files are currently in the same format and I need to do 3 things to the name. First I need to add a leading W to the name, then where the name ends with the extention .dwg i need to make this uppercase (.DWG) and the 3rd thing is I need to add a leading 0 to part of the name.
All the files are in the same format.
Here is an example of a filename i have.
21-11-000-01-103-01.dwg
All the files are similar to this and in the same format of two digits a dash, two more digits, a dash, 3 digits, a dash....etc.. just like the example above. Also they all end with .dwg.
What I need is for this filename to look like this
W21-11-00-01-103-01.DWG
So, the filename needs a leading W to go before the original filename. The 3rd set of digits (the -000) would need to become -00 (cut off the leading digit) and then the .dwg would need to become .DWG.
One more example would be
54-21-061-50-125-30.dwg
Would become:
W54-21-61-50-125-30.DWG
I would appreciate any help with this. I do not know much about shell scripting and I need to do this kind of stuff sometimes. I'm not sure if it would be better to do this in several steps with several scripts..or all together..but..I would really appreciate anybody that would know how to do this.
Thanks
Johnny