logo

utils-std

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

cut.1 (1753B)


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