[lapm] [LA.pm] Numbering files

Eric Hammond ehammond at thinksome.com
Mon May 5 16:12:14 CDT 2003


Ron Smith wrote:
> How would I go about adding a leadin '0' to the files numbered 1-9 
> to make the files list in order like the following:

Assuming you are using bash or an equivalent sh derivative,
you don't need Perl:

   for i in 1 2 3 4 5 6 7 8 9; do mv file.$i file.0$i; done

If you really want to use Perl:

   perl -e 'rename "file.$_", "file.0$_" for 1..9'

Or is the problem really more complicated than what you presented?

--
Eric Hammond
ehammond at thinksome.com



More information about the Losangeles-pm mailing list