LinuxCommandLibrary

look

uses binary search to find lines beginning with a given prefix in a sorted file

TLDR

Find lines starting with prefix

$ look [prefix] [path/to/file]
copy
Search case-insensitive alphanumeric only
$ look -f -d [prefix] [path/to/file]
copy
Specify termination character
$ look -t [char] [prefix] [path/to/file]
copy
Search in dictionary
$ look [prefix]
copy
Search in alternative dictionary
$ look -a [prefix]
copy

SYNOPSIS

look [options] prefix [file]

DESCRIPTION

look uses binary search to find lines beginning with a given prefix in a sorted file. Without a file argument, it searches the system dictionary (/usr/share/dict/words).

PARAMETERS

-f, --ignore-case

Case-insensitive search
-d, --alphanum
Only compare alphanumeric characters
-t, --terminate CHAR
Specify string termination character
-a, --alternative
Use alternative dictionary (web2)

CAVEATS

Requires input file to be sorted. Uses binary search for efficient lookups. Default behavior searches dictionary when no file specified.

SEE ALSO

grep(1), sort(1), spell(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community