I'm a little of the mysql laymen and am requesting a little of the bit of support.

I inherited a wordpress 3.1. website which has about 10,000 posts. Each publish provides extensive irrelevant data the original owner did not need to use, for example getting Google Analytic data in every publish once they might have used a plug-in (Im attempting to imagine them copying that code 10k+ occasions).

I wish to cleanup the posts, but within each one of the 10k posts are two lines of include files encircled by "[]" that If only to help keep.

The posts seem like this:

garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage [include file="filename" masterpath="/home/title/dir"] garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage [include file="filename" masterpath="/home/title/dir"] much more garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage garbage

Transpire, after managing a phpMyAdmin sql dump obviously :) would be to remove all of the garbage all around the [include file] claims.

There Needs to be a method to do that w/ an SQL line or two however, I am a mySQL laymen. Could someone assist me? Getting rid of all cases of the code "by hand" / "manually" is unthinkable...100 posts approximately, maybe...although not 10k posts...

Thanks

I recommend that you simply perform a SQL dump while you suggest, then use a find and replace for your SQL file utilizing a regular expression pattern. If you can get the "sed" utility, you are able to apply the next expression to update the SQL claims:

sed -i -r 's/.*(\[.*\]).*(\[.*\]).*/\1\2/' /path/to/sql_dump_file

Observe that the "-i" flag makes this edit inline, meaning the initial file is changed. Please make certain you've got a backup from the database dump first.

You'll have to constrain this regular expression to simply run from the appropriate SQL Place claims. I recommend copying this portion from your SQL dump file right into a new file to use this operation.

The "-r" flag will permit a long regular expression, which enables us to group our pattern matching. The next string instructs matches just the items in the brackets and discards the relaxation from the data.

A lot of sed here: http://unixhelp.ed.ac.uk/CGI/man-cgi?sed