[lug] simple text editing problem, part 2
Daniel Webb
webb at danielwebb.us
Thu Nov 21 19:22:38 MST 2002
On 19 Nov 2002, Michael J. Hammel wrote:
> > 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.
I missed that feature... It sure does. Does it have a way to add
context lines (like grep -C)? That is a nice feature of qsubst. I can't
tell from a single line all the time if I need to replace. Also, it looks
like cscope doesn't offer a regular expression find and replace like
$ perl -i -p -e 's/from/to/g' *.c *.h
would do. Neither does qsubst, so I'm not totally satisfied yet.
> 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
I think you meant:
$ find . -name "*.c" | xargs cscope
(unless cscope takes files on stdin)
More information about the LUG
mailing list