.\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)look.1 8.1 (Berkeley) 6/14/93 .\" .\" Translated Fri Dec 23 JST 1994 by NetBSD jman proj. .\" Updated Thu Apr 13 JST 2000 by Kentaro Shirakata .Dd June 14, 1993 .Dt LOOK 1 .Os .Sh 名称 .Nm look .Nd 指定した文字列で始まる行を表示する .Sh 書式 .Nm look .Op Fl dfa .Op Fl t Ar termchar .Ar string .Op Ar file .Sh 説明 .Nm look は、 .Ar file の各行のうち、 .Ar string で指定された文字列で始まっている行を表示する。 .Nm look は二分検索を使っているため、 .Ar file で指定するファイルはソートしておかなければならない。( .Nm look で \-d オプションを使うときにはソートするときの .Xr sort 1 にも \-d を使い、\-f オプションを使うときは .Xr sort 1 でも \-f を使うこと) .Pp .Ar file が指定されなかった場合は .Pa /usr/share/dict/word が使用され、 アルファベットと数字だけで比較され、 アルファベットの大文字小文字の違いは無視される。 .Pp オプションとしては以下のものがある: .Bl -tag -width Ds .It Fl d 辞書で使用されているアルファベットと数字だけを比較対象とする。 .It Fl f アルファベットの大文字、小文字を区別しない。 .It Fl a 別の辞書 .Pa /usr/share/dict/web2 を使用する。 .It Fl t 文字列の終端文字を指定する。 つまり、 .Ar string のうち .Ar termchar が最初に出てくるところまで( .Ar termchar を含む)が比較の対象となる。 .El .Sh 返り値 .\" argrath: no .Sh in original .Nm look は、 指定の文字列で始まる行が見つかった場合は 0 を、 見つからなかった場合は 1 を、エラーが起きた場合は 2 以上の値を返す。 .Sh ファイル .Bl -tag -width /usr/share/dict/words -compact .It Pa /usr/share/dict/words デフォルトで使用される単語ファイル .It Pa /usr/share/dict/web2 もう一つの単語ファイル .El .Sh 関連項目 .Xr grep 1 , .Xr sort 1 .Sh 互換性 元の man ページでは .Fl d オプションを指定した時にタブと空白が比較の対象になるとしている。 これは誤りであり、現在の man ページは歴史的な実装と一致している。 .Sh 歴史 .Nm look は Version 7 AT&T Unix から登場した。