The sed command makes it easy to modify text.
$ sed -i "s/django.conf.urls.defaults/django.conf.urls/g" urls.py
You can edit a files contents inplace using the (-i) flag. Multiple files can be passed to sed
using the xargs
command.
$ find -name "*.html" | xargs sed -i "s/<text to change>/<new text>/g"
Perl is well-suited to search and replace. It can also handle multi-line replacements, which are difficult with sed
.
perl -pe "BEGIN{undef $/;} s/<start>.*<stop>/<new text>/smg" <filename>