Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Awk > Re: Can awk, se...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 6 Topic 2196 of 2317
Post > Topic >>

Re: Can awk, sed match mult-line patterns ?

by Ted Davis <tdavis@[EMAIL PROTECTED] > Mar 20, 2008 at 02:55 PM

On Thu, 20 Mar 2008 10:55:05 -0500, problems wrote:

> It seems to me that sed & awk are single line based ?
> 
> I want to delete blocks of text which look like: <opening pattern>
> <2 to 5 lines>
> <closing pattern>
> 
> If I use the <2 to 5 lines>, I can avoid deleting all the good stuff, up
> to the 'next' <closing pattern> in case the assumed <closing pattern> is
> missing/undetected.
> 
> Thanks for any feedback,
>

Pseudocode:

	if line matches opening pattern, set flag
	if flag is clear, print line
	if line matches closing pattern, clear flag

If you want to keep the two pattern lines, interchange the locations of
the two tests.

-- 
T.E.D. (tdavis@[EMAIL PROTECTED]
)
 




 6 Posts in Topic:
Can awk, sed match mult-line patterns ?
problems@[EMAIL PROTECTED  2008-03-20 10:55:05 
Re: Can awk, sed match mult-line patterns ?
A Watcher <stocksami@[  2008-03-20 09:21:32 
Re: Can awk, sed match mult-line patterns ?
Ted Davis <tdavis@[EMA  2008-03-20 14:55:29 
Re: Can awk, sed match mult-line patterns ?
notbob <notbob@[EMAIL   2008-03-20 20:12:01 
Re: Can awk, sed match mult-line patterns ?
Ed Morton <morton@[EMA  2008-03-20 17:26:02 
Re: Can awk, sed match mult-line patterns ?
"Rajan" <svr  2008-03-23 19:28:19 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Jul 24 15:10:19 CDT 2008.