Les wrote:
On Tue, 2007-07-31 at 15:12 -0400, Mark Haney wrote:
Sort will give you the list. I don't know about sorting on a substring
with a command other than creating one. In C, you could read the
directory, then choose the substring using parsing, and finally look at
the last two characters prior to the period to get the sequence and look
for missing files. Do you know the first number and last number? If
not, then this won't work, because the first file and last file would
not have partners on each side to help you figure out if it was
missing.
The -k and -t options of sort may do what is needed. If you want to
sort starting with the 5 character of the name, you could probably
do something like sort -k 1.5 as long as there are no spaces in the
name. I believe something like -k 1.5,1.7 would use the 5th, 6th,
and 7th character. Now, if there is a field separator between parts
of the file name, you can use the -t option to use that to separate
the name into fields. This is handy when the names are not fixed
length. Something like 10-12-07_MKE_10.14_XX.jpg could be split
using _ as the field seperator, and sorting on the 4th field. You
may have to specify a numeric sort, especially if the numbers do not
have leading zeros.
sort -n -t _ -k 4
Mikkel
--
Do not meddle in the affairs of dragons,
for thou art crunchy and taste good with Ketchup!