9fans archive / 2008 / 10 / 358 /    prev next

From: "Rudolf Sykora" <rudolf.sykora@gma...>
Subject: Re: [9fans] non greedy regular expressions
Date: Sat, 25 Oct 2008 00:04:22 +0200

> 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