in reply to Advance Regular expression questions

If you have a "huge sql file", then perhaps it would be more prudent to use SQL, specifically UPDATE, in order to correct these lines. The chances you will corrupt your file are very high, at which point you will no longer have a "huge sql file" and will rather just have a huge junk file.

To go back to a more traditional answer, what have you tried? What didn't work? It sounds like the trick you need is e Modifiers to evaluate your arithmetic after a match. The examples in Search and replace should give plenty of guidance. Post your code, and I'll post mine.