look 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. .TH LOOK 1
  2. .SH NAME
  3. look \- find lines in a sorted list
  4. .SH SYNOPSIS
  5. .B look
  6. [
  7. .BI -dfnixt c
  8. ]
  9. [
  10. .I string
  11. ]
  12. [
  13. .I file
  14. ]
  15. .SH DESCRIPTION
  16. .I Look
  17. consults a sorted
  18. .I file
  19. and prints all lines that begin with
  20. .IR string .
  21. It uses binary search.
  22. .PP
  23. The following options are recognized.
  24. Options
  25. .B dfnt
  26. affect comparisons as in
  27. .IR sort (1).
  28. .TP
  29. .B -i
  30. Interactive.
  31. There is no
  32. .I string
  33. argument; instead
  34. .I look
  35. takes lines from the standard input as strings to be looked up.
  36. .TP
  37. .B -x
  38. Exact.
  39. Print only lines of the file whose key matches
  40. .I string
  41. exactly.
  42. .TP
  43. .B -d
  44. `Directory' order:
  45. only letters, digits,
  46. tabs and blanks participate in comparisons.
  47. .TP
  48. .B -f
  49. Fold.
  50. Upper case letters compare equal to lower case.
  51. .TP
  52. .B -n
  53. Numeric comparison with initial string of digits, optional minus sign,
  54. and optional decimal point.
  55. .TP
  56. .BR -t [ \f2c\f1 ]
  57. Character
  58. .I c
  59. terminates the sort key in the
  60. .IR file .
  61. By default, tab terminates the key. If
  62. .I c
  63. is missing the entire line comprises the key.
  64. .PP
  65. If no
  66. .I file
  67. is specified,
  68. .B /lib/words
  69. is assumed, with collating sequence
  70. .BR df .
  71. .SH FILES
  72. .B /lib/words
  73. .SH SOURCE
  74. .B /sys/src/cmd/look.c
  75. .SH "SEE ALSO"
  76. .IR sort (1),
  77. .IR grep (1)
  78. .SH DIAGNOSTICS
  79. The exit status is
  80. .B \&"not found"
  81. if no match is found, and
  82. .B \&"no dictionary"
  83. if
  84. .I file
  85. or the default dictionary cannot be opened.