HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

look — Display lines beginning with a prefix in a sorted file. Note: The lines in the file must be sorted.

Submitted by: @import:tldr-pages··
0
Viewed 0 times
linescommandbeginningprefixcliwithlookdisplay

Problem

How to use the look command: Display lines beginning with a prefix in a sorted file. Note: The lines in the file must be sorted. See also: grep, sort. More information: <https://man.openbsd.org/look>.

Solution

look — Display lines beginning with a prefix in a sorted file. Note: The lines in the file must be sorted. See also: grep, sort. More information: <https://man.openbsd.org/look>.

Search for lines beginning with a specific prefix in a specific file:
look {{prefix}} {{path/to/file}}


Case-insensitively search only on alphanumeric characters:
look {{[-f|--ignore-case]}} {{[-d|--alphanum]}} {{prefix}} {{path/to/file}}


Specify a string termination character (space by default):
look {{[-t|--terminate]}} {{,}}


Search in /usr/share/dict/words (--alphanum and --ignore-case are assumed):
look {{prefix}}

Code Snippets

Search for lines beginning with a specific prefix in a specific file

look {{prefix}} {{path/to/file}}

Case-insensitively search only on alphanumeric characters

look {{[-f|--ignore-case]}} {{[-d|--alphanum]}} {{prefix}} {{path/to/file}}

Specify a string termination character (space by default)

look {{[-t|--terminate]}} {{,}}

Search in `/usr/share/dict/words` (`--alphanum` and `--ignore-case` are assumed)

look {{prefix}}

Context

tldr-pages: common/look

Revisions (0)

No revisions yet.