First thing I guess is you are at wrong section of the forum.
First thing you need to find is,
Is this can be done while unloading table itself. For that you need to tell how you are unloading table(using which utility etc)
If no such facility is available while unloading table itself then there are many tools\utilities like SORT OR FILEAID(though I don't know it) which will help you to get required.
But for members here to help you, You need to tell the file format\layout\sample records etc
Since you have posted it to PC Guides & IT news part and if it is intentional then
You might want to look for VBA macros to handle this