logo

utils-std

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

cut.1 (1678B)


  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-08-24
  5. .Dt CUT 1
  6. .Os
  7. .Sh NAME
  8. .Nm cut
  9. .Nd cut each line with selected characters/fields
  10. .Sh SYNOPSIS
  11. .Nm
  12. .Fl b Ar list
  13. .Op Fl n
  14. .Op Ar file...
  15. .Nm
  16. .Fl c Ar list
  17. .Op Ar file...
  18. .Nm
  19. .Fl f Ar list
  20. .Op Fl d Ar delim
  21. .Op Fl s
  22. .Op Ar file...
  23. .Sh DESCRIPTION
  24. .Nm
  25. reads lines from each each
  26. .Ar file
  27. or if unspecified standard input,
  28. and cuts out bytes
  29. .Pq Fl b ,
  30. characters
  31. .Pq Fl c ,
  32. or character-delimited fields
  33. .Pq Fl f .
  34. .Pp
  35. The
  36. .Ar list
  37. argument is a comma-separated list of 1-based ranges, where:
  38. .Bl -tag -width _1_2_3_
  39. .It Ql n-
  40. Selects from
  41. .Ql n
  42. to the end of line.
  43. .It Ql n
  44. Selects
  45. .Ql n
  46. .It Ql n-m
  47. Selects from
  48. .Ql n
  49. to
  50. .Ql m .
  51. .It Ql -m
  52. Selects from
  53. start of the line to
  54. .Ql m .
  55. .It Ql 1,2,3
  56. is equivalent to
  57. .Ql 1-3
  58. .El
  59. .Sh OPTIONS
  60. .Bl -tag -width _d_delim
  61. .It Fl b Ar list
  62. Cut bytes based on
  63. .Ar list .
  64. .It Fl c Ar list
  65. Cut codepoints based on
  66. .Ar list .
  67. .It Fl d Ar delim
  68. Set the field delimiter to the character
  69. .Ar delim ,
  70. if an empty string is passed, then NULL is used as separator.
  71. (default:\ \et)
  72. .It Fl f Ar list
  73. Cut fields based on
  74. .Ar list .
  75. .It Fl n
  76. Do not split codepoints. (Currently unsupported in this implementation)
  77. .It Fl s
  78. Suppress lines with no delimiter characters,
  79. otherwise whole delimiter-less lines are printed as-is.
  80. .El
  81. .Sh EXIT STATUS
  82. .Ex -std
  83. .Sh STANDARDS
  84. Except for the lack of support for
  85. .Fl n ,
  86. .Nm
  87. should be compliant with the
  88. IEEE Std 1003.1-2024 (“POSIX.1”)
  89. specification.
  90. .Sh AUTHORS
  91. .An Haelwenn (lanodan) Monnier Aq Mt contact+utils@hacktivis.me