for l in $(grep -r -l '\.jpg' *); do sed -r -i 's/([0-9a-zA-Z_]+)(\.jpg)/images\/\1\2/' $l ; done
With a little side of applesauce...
Wednesday, October 13, 2010
sed - prefix 'images/' to jpg paths in HTML
I openly love sed, and BASH scripting. Today, I was able to modify all of the files in a directory tree, and prefix the new path to each jpg with:
©2006 Shannon Eric Peevey