Batch edit ID3 music tags using custom algorithm
A Combination of AppleScript (or Shell Scripting if you are so inclined), along with a command line tool like id3v2 should do the trick.

You can build id3v2 from source:
http://id3v2.sourceforge.net
Or use MacPorts or HomeBrew to do the building and installation for you.

Once you have it installed you can view the help page by typing in "id3v2 ah" from the terminal. The help page is more helpful than the man page is. 

Then it is just a matter of writing the AppleScript to pass the filenames into variables and use those variables on the command line script like such:

set shellScript to ("id3v2 -T " &amp; trackNumber &amp; space &amp; numberofTracks &amp; space &amp; "/path/to/file") as string
do shell script shellScript


You may also want to think about changing the name of the file itself so that it no longer has the track number in the name! 

I hope this can get you started!