From owner-freebsd-questions@freebsd.org Wed Feb 20 22:54:12 2019 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8B5F114DFE08 for ; Wed, 20 Feb 2019 22:54:12 +0000 (UTC) (envelope-from rtomek@tau1.ceti.pl) Received: from mailout4.ceti.pl (mailout4.ceti.pl [62.121.128.44]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E418073650 for ; Wed, 20 Feb 2019 22:54:11 +0000 (UTC) (envelope-from rtomek@tau1.ceti.pl) Received: from localhost (localhost [127.0.0.1]) by mailout4.ceti.pl (Postfix) with ESMTP id 9E4D2C0550521 for ; Wed, 20 Feb 2019 23:46:50 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mailout1.ceti.pl Received: from mailout4.ceti.pl ([62.121.128.44]) by localhost (mailout1.ceti.pl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bIMkLy6uV0No for ; Wed, 20 Feb 2019 23:46:45 +0100 (CET) Received: from tau1.ceti.pl (tau.ceti.pl [62.121.128.11]) by mailout4.ceti.pl (Postfix) with ESMTP id 540CDC0551345 for ; Wed, 20 Feb 2019 23:46:45 +0100 (CET) Received: by tau1.ceti.pl (Postfix, from userid 3727) id 368A496097E; Wed, 20 Feb 2019 23:46:45 +0100 (CET) Date: Wed, 20 Feb 2019 23:46:45 +0100 From: Tomasz Rola To: freebsd-questions@freebsd.org Subject: Re: silly (non-bsd) split/cat question Message-ID: <20190220224645.GA13862@tau1.ceti.pl> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Rspamd-Queue-Id: E418073650 X-Spamd-Bar: +++ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [3.22 / 15.00]; ARC_NA(0.00)[]; RCVD_COUNT_FIVE(0.00)[5]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_SPAM_SHORT(0.66)[0.656,0]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[freebsd-questions@freebsd.org]; AUTH_NA(1.00)[]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_SPAM_MEDIUM(0.78)[0.776,0]; RCVD_TLS_LAST(0.00)[]; MX_GOOD(-0.01)[cached: tau1.ceti.pl]; NEURAL_SPAM_LONG(0.59)[0.589,0]; RCVD_IN_DNSWL_NONE(0.00)[44.128.121.62.list.dnswl.org : 127.0.15.0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[rtomek@ceti.pl,rtomek@tau1.ceti.pl]; DMARC_NA(0.00)[ceti.pl]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15541, ipnet:62.121.128.0/20, country:PL]; FROM_NEQ_ENVFROM(0.00)[rtomek@ceti.pl,rtomek@tau1.ceti.pl]; IP_SCORE(0.01)[country: PL(0.05)] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Feb 2019 22:54:12 -0000 On Wed, Feb 20, 2019 at 11:15:58AM -0800, Aleksandr Miroslav wrote: > 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. > [...] > 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? copy last 2GiB of bigfile onto x_n (the exact n value, if you want to simulate split, will be probably 6... or 5?) truncate last 2GiB of bigfile n-- repeat until bigfile <2GiB mv bigfile x_0 I have strange feeling that there is no simple cmdline pipe one-liner to do this, instead you will have to write something custom (shell script or better some scripting lang of your liking) and experiment with other file until you are sure it works like it should. -- Regards, Tomasz Rola -- ** A C programmer asked whether computer had Buddha's nature. ** ** As the answer, master did "rm -rif" on the programmer's home ** ** directory. And then the C programmer became enlightened... ** ** ** ** Tomasz Rola mailto:tomasz_rola@bigfoot.com **