logo

utils-std

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

split.1 (1763B)


  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-16
  5. .Dt SPLIT 1
  6. .Os
  7. .Sh NAME
  8. .Nm split
  9. .Nd split a file into chunks
  10. .Sh SYNOPSIS
  11. .Nm
  12. .Op Fl b Ar size | Fl l Ar lines
  13. .Op Fl a Ar suffix_length
  14. .Op Ar file
  15. .Op Ar name
  16. .Sh DESCRIPTION
  17. .Nm
  18. reads
  19. .Ar file
  20. or if unspecified standard input,
  21. and splits it's content into files containing at most
  22. .Ar size
  23. or
  24. .Ar lines .
  25. Each split file name is made with
  26. .Ar name
  27. followed by a base-26 (a-z) suffix of exactly
  28. .Ar suffix_length
  29. characters.
  30. By default, the first split suffix is "aa", then the second is "ab", and so on.
  31. .Sh OPTIONS
  32. .Bl -tag -width Ds
  33. .It Fl a Ar suffix_length
  34. (Default: 2) Set the amount of letters to use for the suffix portion of split files.
  35. .br
  36. Total of
  37. .Ar name
  38. size and
  39. .Ar suffix_length
  40. cannot exceed
  41. .Dv NAME_MAX .
  42. .It Fl b Ar size
  43. Split into files of
  44. .Ar size
  45. bytes,
  46. .Ar size
  47. can be multiplied by one of KMGTP (Kilo, Mega, Giga, Tera, ...)
  48. using power of 1024 by default, which can be either explicit via adding iB
  49. (like MiB), or turned into powers of 1000 by adding B (like MB).
  50. .It Fl l Ar lines
  51. (Default: 1000) Split into files of
  52. .Ar lines
  53. lines.
  54. .El
  55. .Sh OPERANDS
  56. .Bl -tag -width name
  57. .It Ar file
  58. Path to the file to be split, defaults to
  59. .Pa -
  60. if unspecified.
  61. .It Ar name
  62. Prefix to be used for each split file, defaults to
  63. .Ql x .
  64. .br
  65. Total of
  66. .Ar name
  67. size and
  68. .Ar suffix_length
  69. cannot exceed
  70. .Dv NAME_MAX .
  71. .El
  72. .Sh EXIT STATUS
  73. .Ex -std
  74. .Sh SEE ALSO
  75. .Xr csplit 1 ,
  76. .Xr truncate 1
  77. .Sh STANDARDS
  78. .Nm
  79. should be compliant with the
  80. IEEE Std 1003.1-2024 (“POSIX.1”)
  81. specification.
  82. .Sh AUTHORS
  83. .An Haelwenn (lanodan) Monnier Aq Mt contact+utils@hacktivis.me