Re: Subpatterns in Grep?

2012-10-08 Thread jmichel
This sounds fine for my type of use. Thanks again. Le samedi 6 octobre 2012 17:04:43 UTC+2, Patrick Woolsey a écrit : > > > To do this, just modify your existing pattern to find successive pairs of > matching lines and combine their contents: > > Find: (\d{6})(.+)(?:\r\1(.+)) > > Replace

Re: Subpatterns in Grep?

2012-10-06 Thread jmichel
Thanks again. This is reasonably simple for short groups of lines. Le samedi 6 octobre 2012 17:04:43 UTC+2, Patrick Woolsey a écrit : > > At 23:50 -0700 10/05/2012, jmichel wrote: > >Thanks for these explanations. They confirm what I suspected. > >Assuming that the number of lines in one group

Re: Subpatterns in Grep?

2012-10-06 Thread Patrick Woolsey
At 23:50 -0700 10/05/2012, jmichel wrote: >Thanks for these explanations. They confirm what I suspected. >Assuming that the number of lines in one group can never exceed, say, 15 >or so, could one circumvent the difficulty by explicitly repeating the >search pattern a sufficient number of times? Y

Re: Subpatterns in Grep?

2012-10-06 Thread jmichel
Thanks for these explanations. They confirm what I suspected. Assuming that the number of lines in one group can never exceed, say, 15 or so, could one circumvent the difficulty by explicitly repeating the search pattern a sufficient number of times? Then the problem would be to ensure a match a

Re: Subpatterns in Grep?

2012-10-06 Thread jmichel
This sounds amazingly powerful and flexible. Thanks a lot. I will try it asap. The only problem is that I will need to learn Perl if I want to be able to write such scripts… Le samedi 6 octobre 2012 01:25:58 UTC+2, eremita a écrit : > > > On 5 Oct 2012, at 16:18, jmichel > > wrote: > > > I hav

Re: Subpatterns in Grep?

2012-10-05 Thread John Delacour
On 5 Oct 2012, at 16:18, jmichel wrote: > I have a file consisting of groups of lines (unknown number of lines in each > group). > Each line begins by a 6 digit number, followed by an unknown sequence of > words and numbers. > Consecutive lines starting with the same number form a group. > M

Re: Subpatterns in Grep?

2012-10-05 Thread Patrick Woolsey
At 08:18 -0700 10/05/2012, jmichel wrote: >I have a file consisting of groups of lines (unknown number of lines in >each group). >Each line begins by a 6 digit number, followed by an unknown sequence of >words and numbers. >Consecutive lines starting with the same number form a group. >My problem i

Subpatterns in Grep?

2012-10-05 Thread jmichel
I have a file consisting of groups of lines (unknown number of lines in each group). Each line begins by a 6 digit number, followed by an unknown sequence of words and numbers. Consecutive lines starting with the same number form a group. My problem is to combine lines from each group into a si

Re: subpatterns in grep (maybe)

2009-05-26 Thread Ronald J Kimball
On Tue, May 26, 2009 at 09:45:25AM -0700, mmayer344 wrote: > > Hi folks, > > I'm running through some logs of search queries, trying to pull out > the ones containing variations on United Nations. I am trying to write > a regular expression that can match a two letter format (such as "UN", > "U.

subpatterns in grep (maybe)

2009-05-26 Thread mmayer344
Hi folks, I'm running through some logs of search queries, trying to pull out the ones containing variations on United Nations. I am trying to write a regular expression that can match a two letter format (such as "UN", "U.N." or "U. N.") or a two word format ("United Nations", "united +nation").