Is there an equivalent of the unix 'look' command on Windows?

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

Posted 2011-06-30T06:52:15.983

Reputation: 269

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. – None – 2011-06-30T08:07:18.020

Answers

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.

Nordic Mainframe

Posted 2011-06-30T06:52:15.983

Reputation: 125

0

There's always Cygwin.

There's probably a native solution of course.

Szocske

Posted 2011-06-30T06:52:15.983

Reputation: 101

In this case cygwin is unavailable - but according to this page it looks like look isn't available on cygwin either.

– None – 2011-06-30T07:03:34.140

1lookshould 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 – 2011-06-30T07:06:40.493

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. – None – 2011-06-30T07:22:07.807