Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!seismo!brl-adm!rutgers!husc6!Diamond!aweinste
From: aweinste@Diamond.BBN.COM (Anders Weinstein)
Newsgroups: comp.unix.wizards
Subject: Re: Sed question
Message-ID: <2962@quartz.Diamond.BBN.COM>
Date: Thu, 18-Dec-86 16:06:09 EST
Article-I.D.: quartz.2962
Posted: Thu Dec 18 16:06:09 1986
Date-Received: Fri, 19-Dec-86 00:24:40 EST
References: <107@dcl-csvax.comp.lancs.ac.uk>
Reply-To: aweinste@Diamond.BBN.COM (Anders Weinstein)
Distribution: world
Organization: BBN Laboratories, Inc., Cambridge, MA
Lines: 29

In article <107@dcl-csvax.comp.lancs.ac.uk> david@comp.lancs.ac.uk (David T. Coffield) writes:
>In "sed" how can does one form a command to do the following:
>
>Take file A, find the first line beginning with a 150,
>append a line of text at that point and then write out
>file A (all of it) with the newly inserted line.

If the pattern /^150/ is only going to occur once in the input, then it's
easy:

    /^150/a\
    line-of-text-to-append-here

Otherwise, you could try using two loops in the script as follows:

    :loop1
    /^150/{
    a\
    line-of-text-to-append-here
    b loop2
    }
    n
    b loop1
    :loop2
    n
    b loop2

--
Anders Weinstein