Thanks for your reply.In fact,the script is going to run on two processor TRU64 machine, and the size of the file i want to search is over 500M.So I thought that using fork might speed up my search.
I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction
I thought that using fork might speed up my search.
It's pretty unlikely, as it is. Can you split the file into two pieces and put each on separate hard drives with separate controllers? That's more likely to help. (It's not easy to say for sure. There's some black magic with regard to performance optimization. It's absolutely necessary to identify the single most likely bottleneck, though. That's IO here, as it usually is, and having only one file means that that's the most likely place for the bottleneck to start.)
If your actual code is about as simple as that which you posted, GNU grep might be more useful; see the -n option.