Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am doing a mass find and replace using sed and pdftk to find and replace a word in PDF files. When I run the following command,

sed -e "s/word1/word2/g" test.pdf

I get the following error,

sed: RE error: illegal byte sequence

I tried running sed with,

LANG=C sed -e "s/word1/word2/g" test.pdf

and it runs but doesn't find and replace the string.

I should mention that I tried uncompressing the PDF using pdftk, running sed, and then recompressing with no results. I am also running this through MAC OS X bash, but I'm thinking the solution should be relatively the same as Linux command line.

Can anyone offer any suggestions for this?

share|improve this question
Have you seen this Web page?… – MariusMatutiae Sep 29 '13 at 6:19
As a side note/question: is this part of a mail-merge project of sorts? – Michael.M Sep 29 '13 at 6:45
This might also be of interest:… – Michael.M Sep 29 '13 at 6:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.