[support] Search and Replace

Mike Bishop mbishop at adamsonadvertising.com
Wed Jun 13 21:48:44 UTC 2007


In a SQL prompt you could do

UPDATE [table_name] SET [field_name] =
REPLACE([field_name],'[string_to_find]','[string_to_replace]');

Replace the [stuff] including the [] with the tables you want to effect and
the fields...

So
UPDATE node_revisions SET body = REPLACE(body, ŒRed¹, ŒBlue¹);

Would replace all Reds with Blues in the table node_revisions and the field
body.

BACK YOUR DATABASE UP BEFORE YOU TRY THIS!


-- 

Mike Bishop
Digital Mercenary 

ADAMSON ADVERTISING
P. 314.727.9500 x 1237
M. 314.537.6723



From: sessy <sessy at citromail.hu>
Reply-To: <support at drupal.org>
Date: Wed, 13 Jun 2007 23:45:33 +0000
To: <support at drupal.org>
Subject: Re: [support] Search and Replace

A fast solution is to dump the database into an .sql file, and do a
search&replace on it.
Another method would be to do a mysql update using the replace function:
http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_replac
e

regards,

s

Wed, 13 Jun 2007 10:17:30 -0400 -n
"A-NO-NE Music" <madflute at anonemusic.com> írta:

> I finally made the site live last night by modifying htaccess, only to
> find path written in node bodies are all wrong.  Where it says:
>     src/href="sites/..
> It should had said:
>     src/href="/sites/..
> 
> There are million places I have to edit.  How can I do this Search and
> Replace in one shot?
-- 
[ Drupal support list | http://lists.drupal.org/ ]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20070613/3732b5c6/attachment.htm 


More information about the support mailing list