Tugger the SLUGger!SLUG Mailing List Archives

Re: [SLUG] search and replace multiple files?

Sonia Hamilton wrote:

> I'm looking for a GUI that allows me to search and replace in multiple
> files, then leaves open the files that have changed - any pointers?
> For example, I want to replace "def fubar" with "def snafu" across 50
> files. I then want to close all the files that didn't have changes, so I
> can investigate the changed files in more detail (yes, I'm refactoring).
> PS I know about sed, and how to edit multiple files in vim [1].

Assuming that you are keeping this in git, why not just do the

  a) Make sure everything has been commited.

  b) Use sed/perl/python/whatever to do the changes on the command

  c) Use git with an external graphical diff program to review the

For a graphical diff I use mgdiff (in Debian and Ubuntu at least)
and have two aliases:

  alias git-mgdiff='git diff '
  alias git-diff='git diff --no-ext-diff '

The external diff is set up in $HOME/.gitconfig using:

       external = /home/user/scripts/git-mgdiff-wrapper.sh

and the wrapper script is simply:

    mgdiff "$5" "$2"
    exit 0

Erik de Castro Lopo