Unix regular expression question grep, sed

Gregory Bollella bollella at ra.cs.unc.edu
Sun Jun 4 02:02:08 AEST 1989


In article <1421 at xn.LL.MIT.EDU> rkc at 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 at cs.unc.edu
Department of Computer Science
CB# 3175 Sitterson Hall
University of North Carolina
Chapel Hill, NC 27599-3175



More information about the Comp.unix.questions mailing list