Find and Replace Text Within Multiple Files in Linux – Avoid RSI
After updating 100+ pages manually, I realized that I had neglected to add “index.php” to the end of certain links. Usually this would be fine, but the links in question are opened in Shadowbox, which will fail on pretty, “index.php”-less links.
I was able to fix this on the server in 5 seconds with find+perl:
find . -name 'FILE_NAME.EXTENSION' | xargs perl -pi -e 's/FIND/REPLACE/g'
Where FILE_NAME is the name of the files to be searched in (can be ‘*’) and EXTENSION is the filetype (can be ‘*’). FIND is the text to be searched, and REPLACE is a replacement string.
Phew!
Like this post? Move it on along with:
Email |
delicious |
Digg |
Tweet |
Reddit |
Newsvine |
Furl |
Google |
Stumble |
HaoHao
| Trackback: |
Scroll to post title





























Recent Comments
Js Kit Comments Correct Usage Of The Permalink And Path Attributes
HTML codes are always confusing but once one gets the hang of it, things will be pretty smooth from there on.
--
technology essays | essay topics
Wed, 03 Feb 2010 09:04:20 +0000
Js Kit Comments Correct Usage Of The Permalink And Path Attributes
不错啊 挺好的 希望大家有空去也去我的小站光临 http://www.8zyu.com/ welcome to http://www.8zyu.com/ for UGG Boots
Tue, 02 Feb 2010 03:12:37 +0000
Js Kit Comments Correct Usage Of The Permalink And Path Attributes
蜡笔小炘の杂货铺 http://vsinger.jimdo.com
Mon, 01 Feb 2010 13:22:31 +0000
The Best Photographer In Shanghai
When we pick them up :( Don't know when that will be yet!
Chose another 49 today
Wed, 13 Jan 2010 14:13:21 +0000
The Best Photographer In Shanghai
When do we get to see them!!!!!
Tue, 12 Jan 2010 19:08:51 +0000
Installing Jdownloader In Ubuntu
Thank You!!!!
It works like a charm!!!!!!!!!!!!
Tue, 05 Jan 2010 13:02:35 +0000