[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Commands Reference, Volume 3

look Command


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.


-d Specifies dictionary order. Only letters, digits, tabs, and spaces are considered in comparisons.
-f Compares uppercase and lowercase letters as equivalent values. Case is not considered in the sorting so that initial-capital and all-capital words are not grouped together at the beginning of the output.
Note: To use the look -f command, the input file must be sorted with the sort -f command.


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.

Related Information

The grep command, sort command.

Input and Output Redirection Overview in AIX Version 4.3 System User's Guide: Operating System and Devices.

[ Previous | Next | Contents | Glossary | Home | Search ]