Blog | tag: Tool
Back to: Geek StuffMySQL Find and Replace with helper tool that generates SQL for you
How to find and replace text in MySql with an online tool that generates SQL for you.
So this is the SQL for replacing some text in MySQL database:
update [table_name] set [field_name] = replace([field_name],'[string_to_find]','[string_to_replace]');
So if you had a table named "documents" in your database where you wanted to go trough content and replace all absolute URL's with relative ones, you would have something like this:
update documents set content = replace(content, 'http://www.yourwebsite.com/','/');
And now that we went trough the boring stuff, here is something to make it a bit easier.
ttest
P.S. The image in header is made by my girlfriends and mine fingers (except for the MySql text which was added in Photoshop) on the iPhone with Brushes app
Recent posts
- Thursday, 21. january 2010. Find files larger than X and delete them in Mac OS/Unix terminal
- Tuesday, 15. december 2009. Bananica.com - Finally!
- Monday, 14. december 2009. MySQL Find and Replace with helper tool that generates SQL for you
- Monday, 14. december 2009. Synchronize two folders on a Mac with Automator and Rsync
- Monday, 14. december 2009. Synchronize two folders on a Mac and other Unix Systems with Rsync
- Sunday, 13. december 2009. Add all new files and folders to subversion with one line in terminal
Recent comments
-
Wednesday, 24. february 2010. karol commented on Add all new files and folders to subversion with one line in terminal Great! However, this doesn't work if your file names contain spaces.
I managed to compile several snippets from the net and came up with this:
svn status | grep "^?" | awk '{$1="";$0=substr($0,2)}1' | sed -e "s,[^.],\'&," -e "s,\$,\'," | xargs svn add
Phew! Works in Snow Leopard. - Tuesday, 23. february 2010. eMancu commented on Synchronize two folders on a Mac and other Unix Systems with Rsync Thanks a lot! I was looking for --delete example :)
-
Wednesday, 13. january 2010. annmarie commented on Ambium Ja, meni je moja spletna stran noro dobra. Na svetovnem nivoju, ni kaj.