Renamed since I want to keep the sql and the shell bits separate.
Just the shell script bit
Renamed
Make export idempotent by keeping a file of all previously exported intids