msgbartop
programming, reviews, code, culture, civilization, media, php, python, and more
msgbarbottom

 
msgbartop
msgbarbottom

01 Nov 08 Edit a line in all php files in a directory with find and sed

Here is about the simplest example I could come up with, to change a reference to a new include directory location in a codebase.

You can of course do fancier things should you wish to dump your results to a directory before overwriting your files.

#!/bin/sh
for files in `find *.php`
do
sed ’s/..\/..\/adminincl/includes/g’ $files > ‘temp’.$files && mv ‘temp’.$files $files
done

Tags: , , ,


 
msgbartop
msgbarbottom

SuperWebDeveloper.com is Digg proof thanks to caching by WP Super Cache!