Using Regular Expresions to change .htm to .php in files
Tobiah
toby at tobiah.org
Thu Aug 23 15:27:10 EDT 2007
sebzzz at gmail.com wrote:
> Hi,
>
> I have a bunch of files that have changed from standard htm files to
> php files but all the links inside the site are now broken because
> they point to the .htm files while they are now .php files.
>
> Does anyone have an idea about how to do a simple script that changes
> each .htm in a given file to a .php
>
> Thanks a lot in advance
>
#!/bin/bash
for each in *.php; do
sed "s/.htm/.php/g" < $each > /tmp/$$
mv /tmp/$$ $each
done
--
Posted via a free Usenet account from http://www.teranews.com
More information about the Python-list
mailing list