[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: binary search in a file

From: Colin S. Miller
Subject: Re: binary search in a file
Date: Thu, 14 Jul 2005 11:46:44 +0100
User-agent: Debian Thunderbird 1.0.2 (X11/20050331)

Sorav Bansal wrote:
Is there a utility to search for a value in a sorted file using binary search. The file was sorted using the 'sort' command.

Is there any reason why you want to use a binary search, except for speed?

Unless the lines are fixed-length, after each chop, the search program
will have to find the start-of-line character.
This is likely to negate any advantage gained from binary searches.

I'd sugest just sticking to grep. You can use the '-l' (ell) option -
this will exit when the first matching line is found, (but not display it).

Colin S. Miller

reply via email to

[Prev in Thread] Current Thread [Next in Thread]