• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 184
  • Last Modified:

find and replace

Hi All

I want to search the whole filesystem for nobody@noreply.com and replace it with another email address.

Any ideas on how to do this?
0
willa666
Asked:
willa666
  • 2
1 Solution
 
TintinCommented:
find / -type f -exec grep -l 'nobody@noreply.com' {} \; | xargs -i sed -i 's/nobody@noreply.com/another@email.address/' {}
0
 
TintinCommented:
might be easier to read as a code snippet
find / -type f -exec grep -l 'nobody@noreply.com' {} \; | xargs -i sed -i 's/nobody@noreply.com/another@email.address/' {}

Open in new window

0
 
willa666Author Commented:
Hi Tintin

Kewl and if i want to limit the search replace to a certain directory i can just do

 find /var/www/vhosts/ -type f....

Tar
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now