This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Gopu Akraju wrote:I tried in oerl but due to extensive search it is taking quite a long time
This sounds like a non-trivial operation and with thousands of records, is bound to take a lot of time. I don't think shell scripts are faster than perl, especially for this kind of operation which is not well-suited for scripting. You may gain some speed with Java or C, but probably not much (speculation on my part).
Maybe if you showed us your perl, we could help you tweak it (well, maybe someone else. I'm not a perl guy).