I had to search and replace a string today and figured i'd post it up here in case it'll help someone..
I cloned a site for a client and had to replace some hardcoded paths in their millions of (seems like) files.. here is what I used to get it done quickly:
That may look a little funny because I had to escape the forward slashes.. and use a different separator because of the slashes - here's an easier one:Code:find /home/newuser/public_html/ -type f -exec sed -i 's,\/home\/olduser,\/home\/newuser,g' {} \;
Code:find /home/newuser/public_html/ -type f -exec sed -i 's/oldstuff/newstuff/g' {} \




Reply With Quote





Bookmarks