21850Re: [Clip] Remove all lines not containing something
- Jun 30, 2011On 6/30/2011 7:49 AM, diodeom wrote:
> I wrote:To be clearer ;-)
>> I have to admit that I didn't consider the condition where the "keeper" terms are always at the line's end -- despite the provided sample data. Your look-behind is a beautifully simple solution for this case.
> Sorry, Flo -- I quoted the wrong fragment. Here's your pattern I'm referring to, placed in a swap statement:
> ^!Replace "^.+$(?<!org|net)(\R|\Z)" >> "" WARS
I only provided a sample, it might be much different and I don't know
the data going in -- so I literally only know what I want, not what I
don't want. There are hundreds of lines if not thousands sometimes
where I use this. Often it is for race results of running races where I
want to extract a particular team. So we cannot count on \R immediately
after the search term. I assume \Z is file end? Have to look that one
up. So it may appear ANYWHERE IN THE LINE, not only at the end.
I misplaced Flo's email before I responded to it. I'll dig it out again
later as it did have a lot of good stuff in it.
- << Previous post in topic Next post in topic >>