TeachMeJoomla
Sed find and replace in folder |
Here's a handy one-liner to help you replace strings globally throughout all the files in a specified folder. This procedure is also called mass find and replace, or global replace. You can even use it on windows if you're willing to spent a few minutes installing cygwin , a windows port of the gnu/linux most used utilities (including the bash shell and even X11) The code below will replace every occurence of 'ugly' with 'beautiful'. Linux example: find /home/bruno/old-friends -type f -exec sed -i 's/ugly/beautiful/g' {} \;
Cygwin example (you have to use unix-style paths): find /cygdrive/c/xampp/joomla/ -type f -exec sed -i 's/ugly/beautiful/g' {} \;
/cygdrive/c/ stands for the root of your C windows drive letter Also note that Cygwin requires you to use the forward slash delimiter instead of the windows backslash delimiter. The bash shell allows TAB completion for paths, just type the first few letters and hit TAB to auto-complete the path. If you want to filter, let's say, php files, you can add -name '*.php' to command-line arguments, just after the search path. find /cygdrive/c/xampp/joomla/ -type f -name '*.php' -exec sed -i 's/ugly/beautiful/g' {} \; Add as favourites (0)
Powered by AkoComment Tweaked Special Edition v.1.4.2 |
Support TeachMeJoomla
Login Form
Are you secure?
Satisfied?Click below to buy world's best anti virus
Archive
Top SE queries for this URL
sed find and replace
sed windows
find sed
sed replace
sed find
"linux find and replace"
sed search replace
cygwin find replace
sed global replace
sed replace delimiter
sed search and replace
sed global search and replace
replace
find sed replace
sed find URL