help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: creating a tags file for interactive search and replace regexp


From: Eric Hanchrow
Subject: Re: creating a tags file for interactive search and replace regexp
Date: Mon, 19 Jun 2006 18:40:13 -0700
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.51 (gnu/linux)

>>>>> "Ryan" == Ryan Krauss <ryanlists@gmail.com> writes:

    Ryan> I want to do an interactive regexp search and replace on a
    Ryan> list of files.  I don't want to search all the files in one
    Ryan> directory and the files are actually in many different
    Ryan> directories.  How do I do this search and replace on a
    Ryan> specified list?  I think I need a list of tag files.  But I
    Ryan> cannot find an example of the syntax of such a tag file.

Sometimes I make a TAGS file, and then do tags-query-replace.  Read
the man page for etags; it's pretty flexible.  Here's an example of a
shell script that creates a TAGS file for certain files only:

find .                                          \
    \(                                          \
      -type d                                   \
         \(  -iname boring -prune \)      \
      -o \(  -iname also-boring -prune \)               \
    \)                                          \
    -o                                          \
    \(                                          \
    -type f                                     \
    \(                                          \
    -name '*.pas'                               \
    -o -name '*.dfm'                            \
    -o -name '*.p[lm]'                          \
    -o -name '*.js'                             \
    -o -name '*.sql'                            \
    \) -print                                   \
    \) | etags -

You can also do "find-dired", then mark any or all of the resulting
files, then type Q (dired-do-query-replace-regexp).

-- 
One of the fundamental philosophical questions of our time is
why Goofy is a person and Pluto is a dog.
        -- Roger Ebert





reply via email to

[Prev in Thread] Current Thread [Next in Thread]