GNU gettext find and replace
GNU gettext is used by many open source projects for translation support.
If you need to just do a find and replace in gettext source files, try this out to do a whole directory at once:
for i in *.po; do
echo "Processing $i"
msgfilter --no-wrap sed -e "s/OLD_TEXT/NEW_TEXT/g" < $i > /tmp/gettext
mv /tmp/gettext $i
done
I couldn’t find a way to do the edit in place (a la sed -i
), if you know of a way please let me know in the comments.