Batch File Rename

by Kyle on

Leave off the final pipe to /bin/sh to test:

ls foo*.jpg | awk '{ print("mv "$1" "$1) }' | sed 's/foo/bar/2' | /bin/sh

Recursively Find And Replace Text Inside Files

by Kyle on

find . -type f -print | xargs sed -i -e 's/FIND/REPLACE/g'

Remove Iframe Injected Code

by Kyle on

If your index.html and index.php files have suffered from an iframe injection, you can use the following grep/sed command for clearing it out.

Please be careful and test first with just the grep command to ensure you don't clear out anything you don't need.

This command does not backup files!

grep -lr -e '<iframe src="http://.*</iframe>' * | xargs sed -i 's/<iframe src="http:\/\/.*<\/iframe>//g'

Hide Sidebar