tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

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



    Date:        Tue, 14 Feb 2023 12:06:03 -0500
    From:        Jan Schaumann <jschauma%netmeister.org@localhost>
    Message-ID:  <Y+u/e7groFROnRVT%netmeister.org@localhost>

  | 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 disaster) - it is far too
complicated with two many pitfalls, for very little rational benefit.

The normal unix type way to handle this would be to put the split
files for each original file in a directory of their own (a new directory
made just for the purpose).   Then if you want to treat them all as
a single file later, it is just sd?/* (or sd* if you have that many)
and if you want to deal with the split parts of one file, you don't
need to try and work out where one ended and the next starts.

unix directories are cheap, this isn't windows or VMS ... use them!

Note that there's no reason the "name" arg to split cannot be "d1/"
(it works just as one would expect it to.)

And while the man page doesn't say so, the "file" arg can be "-"
(as well as absent) to read stdin, so the name arg can be given in
that case as well.

  | >  $ cat file second-file | split

  | That only works if I have both files available

It also only works if you don't mind the possibility that one of the
pieces has lines (or data anyway, depending upon the split options)
from both the first and second files, as that way split cannot tell
where one ends and the other starts.

kre




Home | Main Index | Thread Index | Old Index