Date: Wed, 20 Feb 2019 22:02:05 +0200 From: Christos Chatzaras <chris@cretaforce.gr> To: FreeBSD Questions <freebsd-questions@freebsd.org> Subject: Re: silly (non-bsd) split/cat question Message-ID: <3F118B74-5B28-484E-A4E0-034E7C0E410A@cretaforce.gr> In-Reply-To: <CACcSE1zUtJLq5HD9S1c7cb-KUpkDpuqNEwKJd0zkabkGAXjP4w@mail.gmail.com> References: <CACcSE1zUtJLq5HD9S1c7cb-KUpkDpuqNEwKJd0zkabkGAXjP4w@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
> On 20 Feb 2019, at 21:15, Aleksandr Miroslav <alexmiroslav@gmail.com> = wrote: >=20 > 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. >=20 > Normally I would "cat x* > bigfile; rm x*" to get the bigfile back. >=20 > 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. >=20 > So I do something like this to reconstitute bigfile: "for i in x*; do > cat $i >> bigfile; rm $i; done" >=20 > That works because I delete each component file as I am recreating > bigfile without going over the free space on my disk. >=20 > 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. >=20 > 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? If you have 12GB of free RAM then mount a /tmpfs , move the file there = and then run something like: cd /home/username; cat /tmpfs/bigfile | split -b 2g I didn't test the last command but it should work.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3F118B74-5B28-484E-A4E0-034E7C0E410A>