silly (non-bsd) split/cat question
alexmiroslav at gmail.com
Wed Feb 20 19:16:12 UTC 2019
Suppose I have 6 files that have been created by split, they are
roughly 2GiB each. The last one is a little smaller. In total, they
take up about 12GiB of space.
Normally I would "cat x* > bigfile; rm x*" to get the bigfile back.
But on this particular box, I only have 9GiB remaining space, so when
bigfile is reconstituted, but before x* are deleted, I would run out
of disk space.
So I do something like this to reconstitute bigfile: "for i in x*; do
cat $i >> bigfile; rm $i; done"
That works because I delete each component file as I am recreating
bigfile without going over the free space on my disk.
If I want to go in the opposite direction and split bigfile into files
of about 2GiB each, I do this: "split -b 2g bigfile; rm bigfile", but
that uses up 12GiB of space before the rm happens.
So my question is this: if I have bigfile, which is about 12GiB in
size, and I have 9GiB left of free disk space, how do I split bigfile
into files of about 2GiB?
More information about the freebsd-questions