lime icon

Phosphorus and Lime

A Developer's Broadsheet

This blog has been deprecated. Please visit my new blog at
The Greps of Wrath
Careful using grep recursively on directories containing images. I wasn't actually using grep, but the code below to change some relatively specific numeric sequences:

# multiple files
# NOTE: in cygwin on XP must have parameter "-i.tmpbak" which create a backup of each file
# which then get deleted below (remove .tmpbak on Unix to edit directly)
find /dirname -name "*"|xargs perl -w -i.tmpbak -p -e "s/search_text/replace_text/g"

# delete temp files
# with prompt before each delete
find -name "*.tmpbak" -ok rm {} \;

# with no prompt (list first then run again with delete command)
find -name "*.tmpbak"
find -name "*.tmpbak" -delete

End up corrupting all my images -- I assume because it matched the search text I had using. But maybe there was another reason.