logo

utils-std

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

comm.1 (1359B)


  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 February 22, 2026
  5. .Dt COMM 1
  6. .Os
  7. .Sh NAME
  8. .Nm comm
  9. .Nd compare two sorted files line by line
  10. .Sh SYNOPSIS
  11. .Nm
  12. .Op Fl 123
  13. .Ar file1
  14. .Ar file2
  15. .Sh DESCRIPTION
  16. .Nm
  17. reads lines from
  18. .Ar file1
  19. and
  20. .Ar file2 ,
  21. and prints out their lines with no prefix when unique to
  22. .Ar file1 ,
  23. prefixed with one tab when unique to
  24. .Ar file2 ,
  25. prefixed with two tabs when common to both.
  26. .Pp
  27. Both
  28. .Ar file1
  29. and
  30. .Ar file2
  31. need to be sorted according to current locale.
  32. .Sh OPTIONS
  33. .Bl -tag -width _0
  34. .It Fl 1
  35. Suppress output of lines unique to
  36. .Ar file1 .
  37. .It Fl 2
  38. Suppress output of lines unique to
  39. .Ar file2 .
  40. .It Fl 3
  41. Suppress output of lines common to both
  42. .Ar file1
  43. and
  44. .Ar file2 .
  45. .El
  46. .Sh EXIT STATUS
  47. .Ex -std
  48. .Sh EXAMPLES
  49. Assuming a file named
  50. .Pa seq1_3.txt
  51. containing the output of
  52. .Ql seq 1 3 .
  53. Show lines only in
  54. .Pa seq1_3.txt ,
  55. lines only in stdin, and common lines:
  56. .Bd -literal -offset indent
  57. $ printf '0\en2\en5\en' | comm - seq1_3.txt
  58. 0
  59. 1
  60. 2
  61. 3
  62. 5
  63. .Ed
  64. .Sh SEE ALSO
  65. .Xr cmp 1 ,
  66. .Xr diff 1 ,
  67. .Xr sort 1 ,
  68. .Xr uniq 1
  69. .Sh STANDARDS
  70. .Nm
  71. should be compliant with the
  72. IEEE Std 1003.1-2024 (“POSIX.1”)
  73. specification.
  74. .Sh AUTHORS
  75. .An Haelwenn (lanodan) Monnier Aq Mt contact+utils@hacktivis.me