Removing all comments from WordPress WXR files
Sometimes, you want to forget that people had an opinion. Or just posted a lot of spam. Either way, you're reading this because you want to get rid of comments in a WordPress WXR export.
sed -i '/<wp:comment>/,/<\/wp:comment>/d' *.xml
On OSX? The installed version of sed doesn't support -i, so you'll need an alternate version. Here's how to install it with Homebrew - http://brew.sh/ -
brew install gnu-sed --default-names
Update your .bash_profile to include gnubin in your PATH:
PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"
Written by Jon Peck
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Sed
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#