tags:

views:

60

answers:

5

i have downloaded a website i have created and want to find the domain name and replace it with a new one without having to open each file.

I use EditPlus

Is there any editor that can do this or do you know how to do this in windows or editplus?

thx

+2  A: 

I'd suggest Notepad++. It has search and replace across one file, all open files, or all files in a directory.

rjh
A: 

Worst case scenario, you could go for a trial version of something like Dreamweaver.

That said, I believe that Notepad++ is capable of this.

middaparka
A: 

I thought EditPlus has a "continue to the next file" button.

So Open all files press ctrl+F find: olddomain replace: newdomain

"Replace all"button and "continue to the next file" button.

Tim
A: 

You can also use Eclipse or Aptana to do this

code-zoop
+1  A: 

You can do this in powershell.

$textToRemove = New-Object System.Text.RegularExpressions.Regex "SOMEREGEX", SingleLine

Get-Item "*.php" | ForEach-Object {
    $backupfile = [System.IO.File]::Copy($_.FullName,"NEWPATH")
    $text = [System.IO.File]::ReadAllText($_.FullName)
    $text = $textToRemove.Replace($text, "REPLACEWITHTHIS")
    $newFile = [System.IO.File]::OpenWrite($_.FullName)
    $newFile.Write($text);
    $newFile.Close()
}

The above is untested code. Powershell is your friend for automating tasks like this.

Joshua Smith
If you're going to use the shell: perl -i -pe 's/word/replace/g' *.php
rjh
Sure, if he's got perl installed. He said he's on a windows box. And, if your going to use shell you can do this in sed in a more portable way doing `find . -type f -name *.php -print |xargs sed -i.BAK 's/word/replace/g'` and that will recurse into the dir structure.
Joshua Smith
find/xargs isn't exactly portable unless you have Cygwin installed. I mentioned Perl because it's just as likely to be installed as PowerShell, if not moreso.
rjh