unix - How can I change numbering in all of the file names? -


i have 1000 files, have format of framexxx.dat, such

frame0.dat frame1.dat frame2.dat .... frame999.dat

i hope change these file's name

frame000.dat frame001.dat frame002.dat .... frame999.dat

is there anyway simple linux command?

also, if files framexx.dat or framexxxx.dat (xx 2digit numbers , xxxx 4 digit numbers) how can change code same?

you have handle them groups:

  • group 0: frame100.dat frame999.dat: nothing here.
  • group 1: frame10.dat frame99.dat: add 1 0

    for in {10..99}; mv frame$f.dat frame0$f.dat; done 
  • group 2: frame0.dat frame9.dat: add 2 0s

    for in {0..9}; mv frame$f.dat frame00$f.dat; done 

a general guideline handle big numbers first (in cases complications arise)

this can extended bigger numbers...you got idea.


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -