programming: October 2008 Archives
I've been messing around with OCR for a possible new project. To train Tesseract, I had to decompress and rename a bunch of .tif files. Rather than deal with Photoshop, I decided to hack a little bash script using tiffcp. This also gave me a chance to play with the regex powers of Bash.
#!/bin/bash
for fname in *.g4.tif
do
if [[ $fname =~ (.*)\.g4\.tif ]]done
then
tiffcp -c none $fname ${BASH_REMATCH[1]}'.tif'else
echo "foo"fi
