Finds lines in a sorted file.
look [ -d ] [ -f ] String [ File ... ]
The look command searches sorted files specified by the File parameter and prints all lines that begin with the string specified by the String parameter. The look command uses a binary search, therefore files specified by the File parameter must be sorted in the C locale collating sequence.
The -d and -f flags affect comparisons as in the sort command. This means a file must be sorted using the -f flag in the sort command before using the look command with the -f flag.
If the File parameter is not specified, the /usr/share/dict/words file is assumed with the collating sequence specified by the -df flags. The sort is completed using the current collating sequence. This should match the collating sequence used to produce the dictionary file. The look command limits the length of a word search to 256 characters.
To search for all lines in the sortfile file that begin with the letter a, enter:
look a sortfile
/usr/share/dict/words | Contains the default dictionary. |
The grep command, sort command.
Input and Output Redirection Overview in AIX 5L Version 5.2 System User's Guide: Operating System and Devices.