Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Mar 2003 08:48:58 -0800 (PST)
From:      Viktor Lazlo <viktorlazlo@telus.net>
To:        Chris P <freebsd@rawfire.torche.com>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: csh question..
Message-ID:  <20030316084346.X66977-100000@a3ij25fvy80j.bc.hsia.telus.net>
In-Reply-To: <Pine.BSF.4.44.0303160020370.69842-100000@rawfire.torche.com>

next in thread | previous in thread | raw e-mail | index | archive | help


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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030316084346.X66977-100000>