If your site got hacked you REALLY should not try to clean the source code they injected!. It is very likely that you will forget something and you may spread malware or whatever to the visitors of your WordPress site. Also try to figure out why you got hacked and fix the hole.
Make sure to delete all files from the server and change all your passwords (FTP, WordPress, etc. etc.).
Here is what you can do:
1) Contact your provider and ask them to setup the latest clean backup
2) Setup your own latest clean backup
3) If you really have no backup (which is very bad) do the following:
- Make a fresh installation of WordPress.
- download your wp-content folder and check this for any malicious code
- download your database and check for any malicious code
- place the clean code / database into the WordPress installation
Simple deleting the first line of each file is most probably not enough. However there are solutions to this:
Batch file to delete first 3 lines of a text file
Delete certain lines in a txt file via a batch file
Note: With an IDE like Netbeans or IntelliJ you can do a search / replace on a huge number of PHP files. This might also help if step three is the only option.
The third possibility is not good because it means a lot of work ... good luck!