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 using Linux Red Hat 5 Enterprise version.

For all files in the current directory, I want to replace all occurrences of /foo/goo/zoo (which are contained in file contents) to /a/b/c.

Any ideas how I can implement that quickly?

share|improve this question
up vote 3 down vote accepted
sed -i 's!/foo/goo/zoo!/a/b/c!g' *
share|improve this answer
Thanks, your solution works! – George2 Jul 28 '10 at 13:19
find DIR -type -f -exec sed -i 's!/foo/goo/zoo!/a/b/c!g' '{}' ';'

(the solution of ignacio is correct, but the glob operator * might run out of space when facing lots of files).

share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.