Hi
I have some 3000 minimaps which I wish to colate into bigger maps
using ImageMagic's montage. Trouble is that some of the maps are
missing. Until I obtain them, I'll put in their place blank maps
of same size and shape.
The names of the minimaps are of the form xxx-yyy_625.jpg, xxx
representing its position on the Ox direction and yyy on the Oy 
direction. 
As such it should be easy enough to build automatically the list 
of files to be given to the montage command with blanks inserted 
at the right positions.
I started to write the following script:

ls | grep _625.jpg | sort >all
cat -n all | cut -f 1 | tr -s ' ' '\t' | sed 's/$/      /' >numbers
                                                #^^^^^-this is a tab
fline=`ls | grep _625.jpg | sort | sed 's/-.*//' | head -1` #first line number
lline=`ls | grep _625.jpg | sort | sed 's/-.*//' | tail -1` #last line number
A=850
#A=$fline
#while [ $A -le $lline ]; do
        if [ `ls | grep -c ^${A}\-` -gt 0 ]; then #bypass void lines
                fcol=`ls ${A}-* | sed "s/${A}-//; s/_625.jpg//" | sort | head 
-1` #first column
                lcol=`ls ${A}-* | sed "s/${A}-//; s/_625.jpg//" | sort | tail 
-1` #last column
                prevcol=`expr $fcol - 1`
                ncols=`expr $fcol - $prevcol` #total number of
                columns, including the empty ones
                ls | grep  ^${A}\- >list
                cat numbers | sed "1,${prevcol}d; ${lcol}q" | sed "s/^  
/${A}-/; s/     /_625.jpg/" >fullist 
                                                                      #^^^-tab  
  #^^^^^ -tab
                                                                      
                diff $list $fullist #This SHOULD give the list of empty columns
        fi
#                A=`expr $A + 1`
#done
echo $A

(Nearly) everything works as expected. The sort commands are
legacy of a previous approach. They are, probably, redundand, but
they do not cause any harm.
The problem is with the diff command. The shell complains:
avraham5t32:~/qtmp/jermap/a$ sh buildlists 
diff: missing operand after `diff'
diff: Try `diff --help' for more information.
The list and fullist temporary files are dully created, and their
diff (at the shell prompt) gives the expected result...
avraham5t32:~/qtmp/jermap/a$ cat list
850-363_625.jpg
850-364_625.jpg
850-365_625.jpg
850-366_625.jpg
850-367_625.jpg
850-368_625.jpg
850-369_625.jpg
850-382_625.jpg
850-383_625.jpg
850-384_625.jpg
850-385_625.jpg
850-386_625.jpg
850-387_625.jpg
850-388_625.jpg
850-389_625.jpg
850-390_625.jpg
850-391_625.jpg
850-392_625.jpg
850-393_625.jpg
850-394_625.jpg
850-395_625.jpg
850-396_625.jpg
850-397_625.jpg
850-398_625.jpg
850-399_625.jpg
850-400_625.jpg
850-401_625.jpg

avraham5t32:~/qtmp/jermap/a$ cat fullist
850-363_625.jpg
850-364_625.jpg
850-365_625.jpg
850-366_625.jpg
850-367_625.jpg
850-368_625.jpg
850-369_625.jpg
850-370_625.jpg
850-371_625.jpg
850-372_625.jpg
850-373_625.jpg
850-374_625.jpg
850-375_625.jpg
850-376_625.jpg
850-377_625.jpg
850-378_625.jpg
850-379_625.jpg
850-380_625.jpg
850-381_625.jpg
850-382_625.jpg
850-383_625.jpg
850-384_625.jpg
850-385_625.jpg
850-386_625.jpg
850-387_625.jpg
850-388_625.jpg
850-389_625.jpg
850-390_625.jpg
850-391_625.jpg
850-392_625.jpg
850-393_625.jpg
850-394_625.jpg
850-395_625.jpg
850-396_625.jpg
850-397_625.jpg
850-398_625.jpg
850-399_625.jpg
850-400_625.jpg
850-401_625.jpg

avraham5t32:~/qtmp/jermap/a$ A=list
avraham5t32:~/qtmp/jermap/a$ B=fullist
avraham5t32:~/qtmp/jermap/a$ diff $A $B
7a8,19
> 850-370_625.jpg
> 850-371_625.jpg
> 850-372_625.jpg
> 850-373_625.jpg
> 850-374_625.jpg
> 850-375_625.jpg
> 850-376_625.jpg
> 850-377_625.jpg
> 850-378_625.jpg
> 850-379_625.jpg
> 850-380_625.jpg
> 850-381_625.jpg

Any ideas?

Thanks, Avraham

=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to