[pm-h] substitution with increment
Russell L. Harris
rlharris at oplink.net
Sun Aug 19 23:50:18 PDT 2007
I have several dozen groups of files; each group consists of one to
several hundred files.
Within each group, the bash "ls" command lists the files in proper
order, because the filename includes a multi-character identifier
(such as 43-29, 43-30, 44-01, 44-02, etc.).
I need to add to the file names within each group a file number, such
that the files may be referenced in proper order as 001, 002, 003,
etc. It is important that the file number contain exactly three
digits.
I am making other changes to the filename, and I have been able to
accomplish everything (undoubtedly crudely) with the diamond operator
and the substitution operator s/// (using the "g" suffix). But I have
not figured out a reasonable scheme for adding the sequential file
number. Can this be done with s/// ?
RLH
More information about the Houston
mailing list