Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!mcnc!thorin!ra!bollella From: bollella@ra.cs.unc.edu (Gregory Bollella) Newsgroups: comp.unix.questions Subject: Re: Unix regular expression question grep, sed Message-ID: <8331@thorin.cs.unc.edu> Date: 3 Jun 89 16:02:08 GMT References: <1421@xn.LL.MIT.EDU> Sender: news@thorin.cs.unc.edu Reply-To: bollella@ra.UUCP (Gregory Bollella) Organization: University Of North Carolina, Chapel Hill Lines: 34 In article <1421@xn.LL.MIT.EDU> rkc@XN.LL.MIT.EDU (rkc) writes: >I have a case where I want to delete, from a text file, something that looks >like: > >/*name*/ >...lots of multiple line junk >/*name*/ > >Everything between the /*name*/ AND both of the /*name*/ lines must be >removed. Finally, name is a known specific name, but the multiple line junk >varies from time to time. I cannot figure out how to write the regular >expression, so if some SED/GREP guru can help me out (maybe with a short >description of why it works) I'd really appreciate it. >E-mail answers; I'll post if others are interested. > Thanks, > -Rob You should be able to use the following: sed /*name*/,/*name*/d < foo where the '/'s are required, the '*'s are part of your name as you indicated in your posting (and not necessary for sed) and foo is your file name. Short description: The (/*name*/,/*name*/) is an address given by two patterns. The 'd' just deletes all that the address indicates. Gregory Bollella bollella@cs.unc.edu Department of Computer Science CB# 3175 Sitterson Hall University of North Carolina Chapel Hill, NC 27599-3175