Hi PVH
This is my initial programm. The structure of the filenames will change to:
filename_xxxx_DDMMYY.pyy
#!/usr/bin/bash
ls cl20* > cl20.txt
awk -v c=${i} -F"." ' BEGIN{l=1}{if (NR==1) { major = substr($1,5,4)+0; minor = substr($1,5,4)+0 }
if ( substr($1,5,4)+0 > major ) major = substr($1,5,4)+0
if ( substr($1,5,4)+0 < minor ) minor = substr($1,5,4)+0
f=substr($1,5,4)+0
file[f]=1
}
END {
print FILENAME
print minor "," major > "f.txt"
#through 0000
if ( (major+1)==10000 ) {
#print "yes"
for ( l=major;l>=1;l-- )
{
#if ( l in file ) {print l > c"_list.txt";limit=l}
if ( l in file ) {limit=l}
}
for ( t=limit;t<=major;t++) { if ( t in file ) print t > c"_list.txt" }
for (j=1;j<=(limit-1);j++)
{
j=sprintf("%0+4s",j)
if (j in file ) {print j >> c"_list.txt" }
}
#for ( t=limit;t<=major;t++) { if ( t in file ) print t }
}
else {
for ( k = minor; k <= major; k++ ){
if ( k in file ) delete file[k]
else {
printf"%0+4s\n", k >> "f.txt"
}
}
}
} ' cl20.txt
cl20.txt
--------
cl203897.p00
cl203898.p00.Z
cl203898.p01.Z
cl203898.p02.Z
cl203898.p03.Z
cl203898.p04.Z
cl203898.p05.Z
cl203898.p06.Z
cl203898.p07.Z
cl203898.p08.Z
cl203898.p09.Z
cl203898.p0a.Z
cl203898.p0b.Z
cl203898.p0c.Z
cl203898.p0d.Z
cl203898.p0e.Z
cl203898.p0f.Z
cl203898.p10.Z
cl203898.p11.Z
cl203898.p12.Z
cl203898.p13.Z
cl203898.p14.Z
cl203898.p15.Z
cl203898.p16.Z
cl203898.p17.Z
cl203898.p18.Z
cl203898.p19.Z
cl203898.p1a.Z
cl203898.p1b.Z
cl203900.p00
cl203900.p01
cl203900.p02
cl203900.p03
cl203900.p04
cl203900.p05
cl203900.p06
cl203900.p07
cl203900.p08
cl203900.p09
cl203900.p0a
cl203900.p0b
cl203900.p0c
cl203900.p0d
cl203900.p0e
cl203900.p0f
cl203900.p10
cl203900.p11
cl203900.p12
cl203900.p13
cl203900.p14
cl203900.p15
cl203900.p16
cl203900.p17
cl203900.p18
cl203900.p19
cl203900.p1a
cl203900.p1b
cl203901.p00
Initial output
faltan.txt
----------
3897,3901
3899
But what happend if the file cl203900.p1a doesn´t appear ?
and if the sequence depends on the date??
Thanks malpa.