🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.help
Article #189110

Operating on lines containing a pattern

#189110
From: Steve Baumgarten
Date: Fri, 03 May 1991 14:00
22 lines
1320 bytes
In "vi" (boo! hiss!), you can do something like this:

	:g/pattern/d

to delete all the lines in a file that contain the pattern "pattern".

Or this:

	:g/pattern/s/p1/p2/

to substitute p2 for p1 in all lines containing the pattern "pattern".

Is there some way to do this in Emacs, short of writing elisp code?
(Or if not, has someone already written appropriate elisp code?)

Any suggestions?

--
   Steve Baumgarten             | "New York... when civilization falls apart,
   Davis Polk & Wardwell        |  remember, we were way ahead of you."
   baumgart@esquire.dpw.com     | 
   cmcl2!esquire!baumgart       |                           - David Letterman
Technical Details
Message-ID: <BAUMGART.91May3100021@esquire.esquire.dpw.com>
Path: arc1-ca.pugleaf.net!gmdzi!unido!math.fu-berlin.de!fauern!ira.uka.de!sol.ctr.columbia.edu!caen!sdd.hp.com!elroy.jpl.nasa.gov!usc!rpi!bu.edu!stanford.edu!hsdndev!cmcl2!esquire!baumgart

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 103b8b,80ffebd709a40a03,start
X-Google-Attributes: gid103b8b,public
X-Google-ArrivalTime: 1991-05-04 00:03:38 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!math.fu-berlin.de!fauern!ira.uka.de!sol.ctr.columbia.edu!caen!sdd.hp.com!elroy.jpl.nasa.gov!usc!rpi!bu.edu!stanford.edu!hsdndev!cmcl2!esquire!baumgart
From: baumgart@esquire.dpw.com (Steve Baumgarten)
Newsgroups: gnu.emacs.help
Subject: Operating on lines containing a pattern
Message-ID: <BAUMGART.91May3100021@esquire.esquire.dpw.com>
Date: 3 May 91 14:00:21 GMT
Sender: news@DPW.COM
Organization: Davis Polk & Wardwell
Lines: 22