Install into PATH e.g. $HOME/bin/ as "git-filter-mv" and chmod a+rx git-filter-mv
It works with any special characters in filenames like tabs and linefeeds. It works with empty commits. Add --prune-empty to the git filter-branch command in case you want to get rid of empty commits after the transformation. Tags are updated to point to the new commits.
Based on example from git-filter-branch manpage.
The expression given should be a valid perl snippet; it receives the value in $_ and expects the variable to be updated (if necessary) by the snippet.
If you want to print debug messages, use STDERR e.g. print STDERR "File: $_\n";