1

I'm looking for an equivalent of the unix look command, which searches a text file for lines beginning with a given prefix. In particular, it has an option for a binary search within a pre-sorted text file.

Does anything like this exist on Windows? I know about find, but it doesn't have the binary search option.

1
  • You don't say why you need the binary search option (or for that matter, why you would use look over grep. findstr /B does what you are asking, but it uses a linear search.
    – Ryan Bemrose
    Jun 30, 2011 at 8:07

2 Answers 2

1

You can find look in util-linux which is straight from ftp.kernel.org/pub/linux/utils/util-linux. look.c is simple enough to be adapted to a mingw or msvc build environment without great hassles.

0

There's always Cygwin.

There's probably a native solution of course.

3
  • In this case cygwin is unavailable - but according to this page it looks like look isn't available on cygwin either.
    – Timothy Jones
    Jun 30, 2011 at 7:03
  • 1
    lookshould be in util-linux which is straight from ftp.kernel.org/pub/linux/utils/util-linux. look.c is simple enough to be adapted to a mingw or msvc build environment without great hassles. Jun 30, 2011 at 7:06
  • Looks great Luther! If you repost that as an answer, I'll give you the check mark. Also, are there any automated tests for the utils? I couldn't see any in an obvious location in that archive.
    – Timothy Jones
    Jun 30, 2011 at 7:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .