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.

Timothy Jones
  • 349
  • 1
  • 2
  • 7
  • 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. –  Jun 30 '11 at 08:07

2 Answers2

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.

Szocske
  • 101
  • 2
  • In this case cygwin is unavailable - but according to [this page](http://www.cygwin.com/packages/) it looks like `look` isn't available on cygwin either. –  Jun 30 '11 at 07:03
  • 1
    `look`should be in `util-linux` which is straight from ftp://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. – Nordic Mainframe Jun 30 '11 at 07: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. –  Jun 30 '11 at 07:22