From 199875ea3580b7fef75ccd4a30a30813bca9926f Mon Sep 17 00:00:00 2001 From: jschauma Date: Mon, 30 Jan 2023 15:22:02 +0000 Subject: auto-extend suffix length if required If the input cannot be split into the number of files resulting from the default suffix length, automatically extend the suffix length rather than bailing out with 'too many files'. Suffixes are extended such that the resulting files continue to sort lexically and "cat *" would reproduce the input. For example, splitting a 1M lines file into (default) 1000 lines per file would yield files named 'xaa', 'xab', ..., 'xyy', 'xyz', 'xzaaa', 'xzaab', ..., 'xzanl'. If '-a' is specified, the suffix length is not auto-extended. This behavior matches GNU sort(1) since around version 8.16. --- usr.bin/split/split.1 | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'usr.bin/split/split.1') diff --git a/usr.bin/split/split.1 b/usr.bin/split/split.1 index a25e3c6ea25..29b2a8d4471 100644 --- a/usr.bin/split/split.1 +++ b/usr.bin/split/split.1 @@ -1,4 +1,4 @@ -.\" $NetBSD: split.1,v 1.15 2007/05/31 01:35:35 jschauma Exp $ +.\" $NetBSD: split.1,v 1.16 2023/01/30 15:22:02 jschauma Exp $ .\" .\" Copyright (c) 1990, 1991, 1993, 1994 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" @(#)split.1 8.3 (Berkeley) 4/16/94 .\" -.Dd May 28, 2007 +.Dd January 28, 2023 .Dt SPLIT 1 .Os .Sh NAME @@ -99,7 +99,12 @@ characters in the range .Dq Li a-z . If .Fl a -is not specified, two letters are used as the suffix. +is not specified, two letters are used as the initial +suffix. +If the output does not fit into the resulting number +of files, then the suffix length is automatically +extended as needed such that all output files continue +to sort in lexical order. .Pp If the .Ar name -- cgit