logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git/

uniq.1 (1401B)


  1. .\" utils-std: Collection of commonly available Unix tools
  2. .\" Copyright 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
  3. .\" SPDX-License-Identifier: MPL-2.0
  4. .Dd 2024-05-02
  5. .Dt UNIQ 1
  6. .Os
  7. .Sh NAME
  8. .Nm uniq
  9. .Nd report or filter out duplicated lines
  10. .Sh SYNOPSIS
  11. .Nm
  12. .Op Fl c Ns | Ns Fl d Ns | Ns Fl u
  13. .Op Fl f Ar field_shift
  14. .Op Fl s Ar byte_shift
  15. .Op Ar input_file Op Ar output_file
  16. .Sh DESCRIPTION
  17. The
  18. .Nm
  19. utility reads
  20. .Ar input_file
  21. line-by-line and by default filters out repeating lines.
  22. .Pp
  23. If no
  24. .Ar input_file
  25. is given or if
  26. .Ar input_file is
  27. .Qq - ,
  28. .Nm
  29. reads from the standard input.
  30. If no
  31. .Ar output_file
  32. is given or if
  33. .Ar output_file is
  34. .Qq - ,
  35. .Nm
  36. writes to the standard output.
  37. .Sh OPTIONS
  38. The following options are supported:
  39. .Bl -tag -width Ds
  40. .It Fl c
  41. Prefix lines with how many times they are duplicated.
  42. .It Fl d
  43. Only write duplicated lines (count > 1).
  44. .It Fl f Ar field_shift
  45. Shift the compared line by
  46. .Ar field_shift
  47. amount of fields, where a field is
  48. .Aq blank
  49. separated.
  50. .It Fl s Ar byte_shift
  51. Shift the compared lines by
  52. .Ar byte_shift .
  53. If
  54. .Ar field_shift
  55. was also specified, it provides an additional shift.
  56. .It Fl u
  57. Only write unique lines (count == 1).
  58. .El
  59. .Sh EXIT STATUS
  60. .Ex -std
  61. .Sh STANDARDS
  62. .Nm
  63. should be compliant with the
  64. IEEE Std 1003.1-2024 (“POSIX.1”)
  65. specification.
  66. .Sh AUTHORS
  67. .An Haelwenn (lanodan) Monnier Aq Mt contact+utils@hacktivis.me