I'm afraid, but I have bad new for you: you can't do it
As mentioned in SVN-Book in "Implementing Repository Hooks" chapter, in comment with Stop-Sign (you know, that it means)
While hook scripts can do almost anything, there is one dimension in
which hook script authors should show restraint: do not modify a
commit transaction using hook scripts. While it might be tempting to
use hook scripts to automatically correct errors, shortcomings, or
policy violations present in the files being committed, doing so can
cause problems. Subversion keeps client-side caches of certain bits of
repository data, and if you change a commit transaction in this way,
those caches become indetectably stale. This inconsistency can lead to
surprising and unexpected behavior. Instead of modifying the
transaction, you should simply validate the transaction in the
pre-commit hook and reject the commit if it does not meet the desired
requirements. As a bonus, your users will learn the value of careful,
compliance-minded work habits.
Jack Repenning, Chief Technology Officer from CollabNet, also mention this
... sadly I must tell you that no, you can't do that. The file content for the files being committed is available to you within the hook script (through svnlook's "changed" and "cat" commands), but what you see is a copy of the data that has already been entered into the database (although not actually committed yet), and you have no facility to modify that, only to allow or refuse the final transaction commit.
If you still brave to try, you can try to understand code from rather old topic (year 2009), where author claims "it modify transaction content"