From mboxrd@z Thu Jan 1 00:00:00 1970 Message-Id: <62C89B14-AB32-4C5B-A99D-35F95E3FD0EE@9grid.es> From: Gabriel Diaz Lopez de la Llave To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Apple Message framework v929.2) Date: Sat, 25 Oct 2008 00:38:50 +0200 References: <765ef13a653652d5fcef9001ff70f814@quanstro.net> <20081024170237.68ED28DE7@okapi.maths.tcd.ie> <6520c845566013ada472281bf9c0da73@coraid.com> Subject: Re: [9fans] non greedy regular expressions Topicbox-Message-UUID: 270fccde-ead4-11e9-9d60-3106f5b1d025 hello using sed and only one reg-exp is mandatory? cat t.txt| sed 's/(ABC | CBA)/ \n\1\n /g' | awk '/ABC/,/CBA/' | grep -=20= v 'ABC|CBA' that's a naive and simple approach, but i can't see why you need to =20 use just one reg-exp and just one sed. May be i missed something =20 through the thread :-? gabi El 25/10/2008, a las 0:04, Rudolf Sykora escribi=F3: >> doesn't s/ABC(the_interesting_part)CBA/x/g work for you? >> maybe i don't understand the example. if so, could you explain? >> >> - erik > > I think not. > I have a file say like this > > ABC asassadfasdf asdfasdf asdfasdf CBA hhhhhhhhhhjjjjjjjjjjioioioi > sodifs > sdfsd > ABC > dasdfas aasdfa > njnjn CBA > > and I want to get > > ' asassadfasdf asdfasdf asdfasdf ' > 'dasdfas aasdfa' > 'njnjn' > > where I added apostrophes to see the spaces on indivial lines. Simply: > give me everything that is between delimiters (ABC and CBA). > > Ruda > >