Bash - Adding 0's in the middle of a file name
- by user596691
I have a bunch of files which are named:
mem0.csv
mem1.csv
.
.
.
.
mem153.csv
.
.
.
They are all in the same folder. When I do ls in the folder they appear in an order of
mem0.csv
mem1.csv
mem10.csv
mem100.csv
.
.
.
mem2.csv
mem20.csv
.
.
.
I want to create a bash script to push 0's between mem and the number. I figure that I need to add 0's until all the filenames are of the same length only problem is that I don't know how to do this.