martedì 20 gennaio 2009

Rembember remember remember


for I in *.txt;do grep -H $(basename $I .txt) $I; done


You don't know why. But I assure you it's useful for me...

lunedì 19 gennaio 2009

Imagemagick cropping 18Mb of png files

In these days I need to crop a lot of png file. They are screenshots of a desktop 1024x768 and I need to remove a frame around the main window. So I didn't want to use a program like gimp opening each file and crop it. So I thought to use a shell script with convert an utility from Imagemagick suite.
This is the code of the shell script:


for I in $(find -name *.png);do
convert -shave 0x46 -crop 1024x768+0+28 $I $I.crop
mv $I $I.old
mv $I.crop $I
done