xref: /freebsd/usr.bin/look/look.1 (revision 7df526eb10c9095e4988e77900f60ba00c42b095)
19b50d902SRodney W. Grimes.\" Copyright (c) 1990, 1993
29b50d902SRodney W. Grimes.\"	The Regents of the University of California.  All rights reserved.
39b50d902SRodney W. Grimes.\"
49b50d902SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without
59b50d902SRodney W. Grimes.\" modification, are permitted provided that the following conditions
69b50d902SRodney W. Grimes.\" are met:
79b50d902SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright
89b50d902SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer.
99b50d902SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright
109b50d902SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer in the
119b50d902SRodney W. Grimes.\"    documentation and/or other materials provided with the distribution.
12fbbd9655SWarner Losh.\" 3. Neither the name of the University nor the names of its contributors
139b50d902SRodney W. Grimes.\"    may be used to endorse or promote products derived from this software
149b50d902SRodney W. Grimes.\"    without specific prior written permission.
159b50d902SRodney W. Grimes.\"
169b50d902SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
179b50d902SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
189b50d902SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
199b50d902SRodney W. Grimes.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
209b50d902SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
219b50d902SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
229b50d902SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
239b50d902SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
249b50d902SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
259b50d902SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
269b50d902SRodney W. Grimes.\" SUCH DAMAGE.
279b50d902SRodney W. Grimes.\"
28f3f16c31SFernando Apesteguía.Dd December 29, 2020
299b50d902SRodney W. Grimes.Dt LOOK 1
309b50d902SRodney W. Grimes.Os
319b50d902SRodney W. Grimes.Sh NAME
329b50d902SRodney W. Grimes.Nm look
339b50d902SRodney W. Grimes.Nd display lines beginning with a given string
349b50d902SRodney W. Grimes.Sh SYNOPSIS
359baefe4aSPhilippe Charnier.Nm
369b50d902SRodney W. Grimes.Op Fl df
379b50d902SRodney W. Grimes.Op Fl t Ar termchar
389b50d902SRodney W. Grimes.Ar string
3947dec781SRuslan Ermilov.Op Ar
409b50d902SRodney W. Grimes.Sh DESCRIPTION
419b50d902SRodney W. GrimesThe
429baefe4aSPhilippe Charnier.Nm
439b50d902SRodney W. Grimesutility displays any lines in
449b50d902SRodney W. Grimes.Ar file
459b50d902SRodney W. Grimeswhich contain
469b50d902SRodney W. Grimes.Ar string
479b50d902SRodney W. Grimesas a prefix.
489b50d902SRodney W. GrimesAs
499baefe4aSPhilippe Charnier.Nm
509b50d902SRodney W. Grimesperforms a binary search, the lines in
519b50d902SRodney W. Grimes.Ar file
529b50d902SRodney W. Grimesmust be sorted.
539b50d902SRodney W. Grimes.Pp
549b50d902SRodney W. GrimesIf
559b50d902SRodney W. Grimes.Ar file
569b50d902SRodney W. Grimesis not specified, the file
579b50d902SRodney W. Grimes.Pa /usr/share/dict/words
589b50d902SRodney W. Grimesis used, only alphanumeric characters are compared and the case of
599b50d902SRodney W. Grimesalphabetic characters is ignored.
609b50d902SRodney W. Grimes.Pp
61f88e6136SPhilippe CharnierThe following options are available:
62f88e6136SPhilippe Charnier.Bl -tag -width indent
63b5bb9538SEitan Adler.It Fl d , -alphanum
646a3e8b0aSRuslan ErmilovDictionary character set and order, i.e., only alphanumeric characters
659b50d902SRodney W. Grimesare compared.
66b5bb9538SEitan Adler.It Fl f , -ignore-case
679b50d902SRodney W. GrimesIgnore the case of alphabetic characters.
68b5bb9538SEitan Adler.It Fl t , -terminate Ar termchar
696a3e8b0aSRuslan ErmilovSpecify a string termination character, i.e., only the characters
709b50d902SRodney W. Grimesin
719b50d902SRodney W. Grimes.Ar string
729b50d902SRodney W. Grimesup to and including the first occurrence of
739b50d902SRodney W. Grimes.Ar termchar
749b50d902SRodney W. Grimesare compared.
759b50d902SRodney W. Grimes.El
7666339977STim J. Robbins.Sh ENVIRONMENT
779b50d902SRodney W. GrimesThe
7866339977STim J. Robbins.Ev LANG , LC_ALL
7966339977STim J. Robbinsand
8066339977STim J. Robbins.Ev LC_CTYPE
8166339977STim J. Robbinsenvironment variables affect the execution of the
829baefe4aSPhilippe Charnier.Nm
8366339977STim J. Robbinsutility.
8466339977STim J. RobbinsTheir effect is described in
8566339977STim J. Robbins.Xr environ 7 .
869b50d902SRodney W. Grimes.Sh FILES
879b50d902SRodney W. Grimes.Bl -tag -width /usr/share/dict/words -compact
889b50d902SRodney W. Grimes.It Pa /usr/share/dict/words
899b50d902SRodney W. Grimesthe dictionary
909b50d902SRodney W. Grimes.El
91a866e170SRuslan Ermilov.Sh EXIT STATUS
9266339977STim J. RobbinsThe
9366339977STim J. Robbins.Nm
9466339977STim J. Robbinsutility exits 0 if one or more lines were found and displayed,
9566339977STim J. Robbins1 if no lines were found, and >1 if an error occurred.
96f3f16c31SFernando Apesteguía.Sh EXAMPLES
97f3f16c31SFernando ApesteguíaLook for lines starting with
98*7df526ebSRaghu Ranganathan.Ql xylen
99f3f16c31SFernando Apesteguíain the file
100f3f16c31SFernando Apesteguía.Pa /usr/share/dict/words :
101f3f16c31SFernando Apesteguía.Bd -literal -offset indent
102f3f16c31SFernando Apesteguía$ look xylen
103f3f16c31SFernando Apesteguíaxylene
104f3f16c31SFernando Apesteguíaxylenol
105f3f16c31SFernando Apesteguíaxylenyl
106f3f16c31SFernando Apesteguía.Ed
107f3f16c31SFernando Apesteguía.Pp
108f3f16c31SFernando ApesteguíaSame as above, but do not consider any characters in
109f3f16c31SFernando Apesteguía.Ar string
110f3f16c31SFernando Apesteguíabeyond the first
111f3f16c31SFernando Apesteguía.Ql e .
112f3f16c31SFernando ApesteguíaNote that
113f3f16c31SFernando Apesteguía.Fl f
114f3f16c31SFernando Apesteguíais implicit since we are searching the default file
115f3f16c31SFernando Apesteguía.Pa /usr/share/dict/words :
116f3f16c31SFernando Apesteguía.Bd -literal -offset indent
117f3f16c31SFernando Apesteguía$ look -t e xylen
118f3f16c31SFernando ApesteguíaXyleborus
119f3f16c31SFernando Apesteguíaxylem
120f3f16c31SFernando Apesteguíaxylene
121f3f16c31SFernando Apesteguíaxylenol
122f3f16c31SFernando Apesteguíaxylenyl
123f3f16c31SFernando Apesteguíaxyletic
124f3f16c31SFernando Apesteguía.Ed
1259b50d902SRodney W. Grimes.Sh COMPATIBILITY
1269b50d902SRodney W. GrimesThe original manual page stated that tabs and blank characters participated
1279b50d902SRodney W. Grimesin comparisons when the
1289b50d902SRodney W. Grimes.Fl d
1299b50d902SRodney W. Grimesoption was specified.
1309b50d902SRodney W. GrimesThis was incorrect and the current man page matches the historic
1319b50d902SRodney W. Grimesimplementation.
132b245fc98SEitan Adler.Pp
133b245fc98SEitan AdlerThe
134b245fc98SEitan Adler.Fl a
135b5bb9538SEitan Adlerand
136b5bb9538SEitan Adler.Fl -alternative
137463a577bSEitan Adlerflags are ignored for compatibility.
138159cd5c6STim J. Robbins.Sh SEE ALSO
139159cd5c6STim J. Robbins.Xr grep 1 ,
140159cd5c6STim J. Robbins.Xr sort 1
1419b50d902SRodney W. Grimes.Sh HISTORY
142e8937ba0SPhilippe CharnierA
143e8937ba0SPhilippe Charnier.Nm
144e8937ba0SPhilippe Charnierutility appeared in
1450f778506SMike Pritchard.At v7 .
1463d1a0148STim J. Robbins.Sh BUGS
14766339977STim J. RobbinsLines are not compared according to the current locale's collating
14866339977STim J. Robbinsorder.
14947991832STim J. RobbinsInput files must be sorted with
15047991832STim J. Robbins.Ev LC_COLLATE
15147991832STim J. Robbinsset to
15247991832STim J. Robbins.Ql C .
153