Re: lines matching N and N+1
"Daniel" <[email protected]>
| Newsgroups | gmane.editors.sed.user |
|---|---|
| Message-ID | <[email protected]> |
You're right. The t is not necessary. I'll have to look more at this when I have some time. I found something else, either a glitch with yahoo groups or something I'm doing wrong. In my little script (9152), \< and \> did not get sent correctly. I apologize script I posted ended up mangled... \< and \> show up when composing messsage, but tend to drop out (get changed to a space) when message is sent or previewed, as shown below: Using \bfoo\b syntax (Seems to show up fine): $! N s:(.*)\bfoo\b(.*)\n(.*)\bbar\b(.*):\1FOO\2\n\3BAR\4: P; D Using \< and \> syntax (Drops out every time I try): $! N s:(.*)\<foo\>(.*)\n(.*)\<bar\>(.*):\1FOO\2\n\3BAR\4: P; D Using HTML entities for GT and LT (Won't know if drops out or shows up until I read the post): $! N s:(.*)\<foo\>(.*)\n(.*)\<bar\>(.*):\1FOO\2\n\3BAR\4: P; D Has anyone else noticed this behavior? I'm guessing this is because yahoo allows HTML. Is there some setting I might change? Or something I'm doing wrong? Any work-around, other than entering HTML entities? Daniel --- In [email protected], Davide Brini wrote: > > On Fri, 1 Feb 2013 11:03:38 +0100, Davide Brini wrote: > > > > t > > > > There's no harm in printing the first line of the pattern space, so the > > "t" can be removed. In fact, every time "t" is executed, you're > > effectively adding two more lines to the pattern space without removing > > the existing ones. This can lead to false matches in the s::: replacement > > (ie, times where foo and bar are more than one line apart, yet the > > replacement succeeds). > > This is of course wrong. The appropriate remark is that by using "t", the > two lines currently in the buffer are printed at once, and foo/bar pairs > can be missed if "foo" is in the second of the two lines being printed. > Either way, "t" is at best useless. > > -- > D. >