Re: split(1): add '-c' to continue creating files

2023-02-14 Thread Jan Schaumann
Robert Elz wrote: > Most of the rest of this proposal is (a disaster) - it is far too > complicated with two many pitfalls, for very little rational benefit. ¯\_(ツ)_/¯ -Jan

Re: split(1): add '-c' to continue creating files

2023-02-14 Thread Robert Elz
Date:Tue, 14 Feb 2023 12:06:03 -0500 From:Jan Schaumann Message-ID: | Setting the first name is a good alternative. Or just the first suffix, an option for that would not be a disaster. But it really shouldn't be needed. Most of the rest of this proposal is (a di

Re: split(1): add '-c' to continue creating files

2023-02-14 Thread Valery Ushakov
On Tue, Feb 14, 2023 at 17:31:36 +0100, Martin Husemann wrote: > On Sun, Feb 12, 2023 at 04:05:20PM -0500, Jan Schaumann wrote: > > The attached diff adds a flag "-c" (mnemonic "create, > > don't overwrite" or "continue where you left off"): > > > > $ split file; ls > > xaa xab xac xad > > $ spli

Re: split(1): add '-c' to continue creating files

2023-02-14 Thread Mouse
>> Besides, isn't your intended behaviour easily done with: >> $ cat file second-file | split > That only works if I have both files available at the time I run the > split command. It also will (unless the first file is a multiple of the split size) take the last part of file and the first par

Re: split(1): add '-c' to continue creating files

2023-02-14 Thread Jan Schaumann
Martin Husemann wrote: > How about instead adding an option that sets the first name explicitly > and keeps the "abort on failure" behaviour? Setting the first name is a good alternative. I'll have to see how that works with specifying a prefix (e.g., user specified a first file that doesn't ma

Re: split(1): add '-c' to continue creating files

2023-02-14 Thread Edgar Fuß
> How about instead adding an option that sets the first name explicitly > and keeps the "abort on failure" behaviour? That looks like a much better idea to me.

Re: split(1): add '-c' to continue creating files

2023-02-14 Thread Martin Husemann
On Sun, Feb 12, 2023 at 04:05:20PM -0500, Jan Schaumann wrote: > The attached diff adds a flag "-c" (mnemonic "create, > don't overwrite" or "continue where you left off"): > > $ split file; ls > xaa xab xac xad > $ split -c second-file; ls > xaa xab xac xad xae xaf xag xah xai xaj I think this i

Re: split(1): add '-c' to continue creating files

2023-02-14 Thread Mouse
> $ split -n 4 -c file; ls > xaa xab xac xad xae xaf xag > --- --- --- --- > I don't see a way around that: split(1) would need to look ahead at > _any_ possible file to be able to determine if the current file name > falls into a hole in the sequence. That isn't that hard to do, assu

Re: split(1): add '-c' to continue creating files

2023-02-14 Thread Jan Schaumann
Ignatios Souvatzis wrote: > Definitely O_EXCL and EEXIST, yes. But we still can fall into a hole > in the sequence, fill it, and skip over the remaining part(s), thus > interleaving our new and the preexisting files. Ah, you mean if I currently have $ ls xaa xad xae and then run $ split -n 4

Re: split(1): add '-c' to continue creating files

2023-02-14 Thread Ignatios Souvatzis
On Sun, Feb 12, 2023 at 04:19:43PM -0500, Jan Schaumann wrote: > Jan Schaumann wrote: > > > The attached diff adds a flag "-c" (mnemonic "create, > > don't overwrite" or "continue where you left off"): > > Ugh, and once more without a race condition. [...] Definitely O_EXCL and EEXIST, yes. Bu