Help in Search ALgorithm in Unix

I am tryin to change the sort fields in mainframes to the equivalent in Unix. I have a large datafile of which i extract only the specified fields ... cut them ... write it into another file with a delimiter... and sort based on these fields... then match these fields to those from input file ... problem is while matching i use sequential search which is very expensive... Is there any alternate search? binary search wudnt work bcos it needs a sorted file... any ideas??? :confused:

Why can you not sort the entire big file to start with?

I cannot sort the entire file because i hav to sort based on certains char like equivalent in mainframes sort fields=(startpos,lenght,asc/desc,char/num)
this pattern can be repeated as many times in hte single command

You can specify multiple sort keys in Unix.

Try reading the man page for sort

man sort