From owner-freebsd-questions@FreeBSD.ORG Fri Aug 29 13:14:57 2014 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6E08EF6E for ; Fri, 29 Aug 2014 13:14:57 +0000 (UTC) Received: from smtpy.mta.ca (smtpy.mta.ca [138.73.1.205]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 40FC01BAF for ; Fri, 29 Aug 2014 13:14:56 +0000 (UTC) Received: from qemg.mta.ca ([138.73.29.51]:49160 helo=qemg.org) by smtpy.mta.ca with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.84) (envelope-from ) id 1XNLf1-0000Wr-2w; Fri, 29 Aug 2014 09:52:11 -0300 Date: Fri, 29 Aug 2014 09:52:11 -0300 (ADT) From: Andrew Hamilton-Wright To: Polytropon Subject: Re: Moving Text In vi(1) To Another File In-Reply-To: <20140829104726.dc4aa238.freebsd@edvax.de> Message-ID: References: <540037DE.4030404@gmail.com> <20140829104726.dc4aa238.freebsd@edvax.de> User-Agent: Alpine 2.11 (BSF 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Jamie Griffin , FreeBSD Questions X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Aug 2014 13:14:57 -0000 On Fri, 29 Aug 2014, Polytropon wrote: > On Fri, 29 Aug 2014 09:20:46 +0100, Jamie Griffin wrote: >> What is the best way to copy large sections of text in a file and copy >> it to another file, possibly a new file or not. Is vi even the best >> utility to do that? > > The "best" utility is the one you're most familiar with, > regarding the particular task. Good advice. This is easy in vi, as 'w' (write) works essentially the same as (command-line) yank. Assuming you are yanking your data via something like: :100,200y (with 100 and 200 standing in as the line range), then you can simply do this instead :100,200w myNewFile or :100,200w /my/new/faraway/file if you want to include a path to the file. A