On Wed, Mar 28, 2012 at 5:21 AM, blue-orange <[email protected]> wrote:
> I have two txt files containing 1000 thumbnail and original image
> filenames that look like this:
>
> original.txt:
> Photo_19001_2010-11-18_13.45.59_orig.jpg
> Photo_19002_2010-11-18_21.07.04_orig.jpg
> Photo_19003_2010-11-19_10.48.19_orig.jpg
> Photo_19004_2010-11-19_14.05.01_orig.jpg
> Photo_19005_2010-11-19_14.05.05_orig.jpg
> ...
>
> preview.txt:
> Photo_19001_2010-11-18_13.45.59_prev.jpg
> Photo_19002_2010-11-18_21.07.04_prev.jpg
> Photo_19003_2010-11-19_10.48.19_prev.jpg
> Photo_19004_2010-11-19_14.05.01_prev.jpg
> Photo_19005_2010-11-19_14.05.05_prev.jpg
>
        


Assuming that :

1. all of the filenames are exactly the same except that "_orig.jpg"
changes to "_prev.jpg"
2. the file 'original.txt' has one filename per line

then you can use a small shell script to do this:

        #!/bin/sh
        
        while read line
        do
        
                PREV=`echo "$line" | sed 's#_orig.jpg#_prev.jpg#g'`
        
                echo "<a href=\"$line\"><img src=\"$PREV\"></a>"
        
        done < original.txt

I put this script up at
<http://dl.dropbox.com/u/18414/tmp/bbedit3282012.sh> if you want to
download it.

Save it to the same directory as 'original.txt'. Assuming they are
both on ~/Desktop/ then you would open Terminal.app and do

        cd ~/Desktop/

        chmod 755 ./bbedit3282012.sh

        ./bbedit3282012.sh

or, if you want to save the output of `bbedit3282012.sh`, then do

        ./bbedit3282012.sh > out.html

and then the file "out.html" will have the HTML that you need.

TjL

ps - I really can't help but mention that you should include WIDTH and
HEIGHT on the IMG tags. Otherwise the page is going to "jump" all over
the place as those 1,000 images load!! I assume you just left them off
your example to reduce visual clutter.

-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
<http://groups.google.com/group/bbedit?hl=en>
If you have a feature request or would like to report a problem, 
please email "[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>

Reply via email to