Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!brutus.cs.uiuc.edu!zaphod.mps.ohio-state.edu!mips!apple!oracle!news From: nhess@dvlseq.oracle.com (Nate Hess) Newsgroups: gnu.emacs Subject: Re: List and edit lines containing certain strings ? Message-ID: <1990Feb28.155843.1260@oracle.com> Date: 28 Feb 90 15:58:43 GMT References: Sender: news@oracle.com Reply-To: nhess@dvlseq.oracle.com (Nate Hess) Distribution: gnu Organization: Oracle Corporation, Belmont, CA Lines: 28 In-reply-to: jiang@bohr.rice.edu (Jun Jiang) Posting-Front-End: Gnews 2.0 In article , jiang@bohr (Jun Jiang) writes: >I am wondering how hard it will be to let gnu-emacs do the following: >1). Upon request, list all lines (and only these lines) which contain >a certain string in the current buffer. For example, list those lines >containing ``real*8'' in a FORTRAN program. You can do this using `M-x occur', and another window will pop up containing all lines with the string you specified. >2). Edit these lines in the new buffer. For example, change some of >the ``real*8'' to ``real*4''. >3). When the changes are done, exit the new buffer and return to the >original one. Of course, the changes should not be lost. Steps 2 and 3 you can't do directly with off-the-shelf Emacs, but you can get something close with `M-%', which is query-replace. You might try getting help on both of these commands to see if together they do what you want. (`C-h f' for help) --woodstock -- "What I like is when you're looking and thinking and looking and thinking...and suddenly you wake up." - Hobbes nhess@oracle.com or ...!uunet!oracle!nhess or (415) 598-3046