From owner-freebsd-questions Sun Mar 16 8:49:13 2003 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 31C6537B404 for ; Sun, 16 Mar 2003 08:49:12 -0800 (PST) Received: from priv-edtnes44.telusplanet.net (outbound05.telus.net [199.185.220.224]) by mx1.FreeBSD.org (Postfix) with ESMTP id C956F43FAF for ; Sun, 16 Mar 2003 08:49:10 -0800 (PST) (envelope-from viktorlazlo@telus.net) Received: from [192.168.1.100] ([207.6.246.202]) by priv-edtnes44.telusplanet.net (InterMail vM.5.01.05.17 201-253-122-126-117-20021021) with ESMTP id <20030316164910.EREF3906.priv-edtnes44.telusplanet.net@[192.168.1.100]>; Sun, 16 Mar 2003 09:49:10 -0700 Date: Sun, 16 Mar 2003 08:48:58 -0800 (PST) From: Viktor Lazlo X-X-Sender: viktorlazlo@a3ij25fvy80j.bc.hsia.telus.net To: Chris P Cc: freebsd-questions@FreeBSD.ORG Subject: Re: csh question.. In-Reply-To: Message-ID: <20030316084346.X66977-100000@a3ij25fvy80j.bc.hsia.telus.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sun, 16 Mar 2003, Chris P wrote: > How about an example? I know only know sed for replacing things, not > inserting a new line into a file in a specific place, even though the info > around it changes. > > > On Sat, 15 Mar 2003, Chris P wrote: > > > > > > > > Hello.. > > > Not really a freebsd question, but still a good forum to ask this. > > > How would I insert a line into a file via a csh script. example... > > > I have a file that is generated via the script, and I need to insert a > > > line between line 1 and 2. I could do it via a head, or tail statement, > > > and alot of steps, but I was wondering if there was an easier way to do > > > it. Exactly how you do it within your script depends on what else is happening, but this shows one way of doing it from the command line: cat originalfile | sed -n '1G;p' >modifiedfile Cheers, Viktor To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message