[lug] simple text editing problem, part 2

Michael J. Hammel mjhammel at graphics-muse.org
Tue Nov 19 09:13:54 MST 2002


On Mon, 2002-11-18 at 17:26, Daniel Webb wrote:
> I asked back in August about being able to find and replace in multiple
> files interactively.  Several solutions were offered:
> 
> Source Navigator:  Only does search and replace on one file at a time
> cscope: Only does find, no auto-replace

Not true.  the option Change this text string:" will replace one string
with another in as many files as you specify and in as many locations
within each file as you specify.  This is one of the main reasons I
started using Cscope.  The trick is telling cscope what files to use.

The way you can do this in a single directory:

   cscope *.c *.h

that will make all C source available to you for search/replace options.

To do this with a source tree, you have to get clever.  I use shell
functions to build a list of files, something like this (but actually
more complex):

find . -name "*.c" | cscope

If anyone wants the shell scripts, I can make them available.  I
actually just do 

   scope .

(with "scope" the name of my shell function) to run cscope against all
source files (of varying types) in the current tree on down.


-- 
Michael J. Hammel <mjhammel at graphics-muse.org>
Graphics Muse




More information about the LUG mailing list