update text inside a post (we work with 3rd party vendors, their urls occasionally change; or we changed a campaign's name used in google analytics) and limit it to ONLY published posts. (sometimes, our marketing team wants to what see how content was EXACTLY in the past). wp-cli's search-replace command by default make edits in revisions.
(in this command, 'before' is what you want to get rid of and 'after' is what you want to replace 'before' with.
wp db query "UPDATE $(wp db tables "*_posts") SET post_content = REPLACE(post_content, 'before', 'after') WHERE post_status = 'publish';"