RE: Using Regular Expresions to change .htm to .php in files

2007-08-26 Thread Ryan Ginstrom
> On Behalf Of Mark > This line should be: > > sed "s/\.htm$/.php/g" < $each > /tmp/$$ I think a more robust way to go about this would be: (1) Use os.walk to walk through the directory http://docs.python.org/lib/os-file-dir.html (2) Use Beautiful Soup to extract the internal links from each

Re: Using Regular Expresions to change .htm to .php in files

2007-08-26 Thread Mark
On Thu, 23 Aug 2007 12:27:10 -0700, Tobiah wrote: > sed "s/.htm/.php/g" < $each > /tmp/$$ This line should be: sed "s/\.htm$/.php/g" < $each > /tmp/$$ -- http://mail.python.org/mailman/listinfo/python-list

Re: Using Regular Expresions to change .htm to .php in files

2007-08-25 Thread Tobiah
[EMAIL PROTECTED] 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 t

Re: Using Regular Expresions to change .htm to .php in files

2007-08-24 Thread Tim Williams
On 24/08/07, J. Cliff Dyer <[EMAIL PROTECTED]> wrote: > Tim Williams wrote: > > On 23/08/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> 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 becau

Re: Using Regular Expresions to change .htm to .php in files

2007-08-24 Thread J. Cliff Dyer
I'd actually skip checking where the links are coming from, and just pretend any link could be .htm or .html. Check for both cases, either using a regex or just fix the .html cases first. So do 2 passes. Pass 1: Data.replace('.html', '.php') Pass 2: Data.replace('.htm','.php') I make no cl

Re: Using Regular Expresions to change .htm to .php in files

2007-08-24 Thread J. Cliff Dyer
Tim Williams wrote: On 23/08/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> 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 h

Re: Using Regular Expresions to change .htm to .php in files

2007-08-23 Thread Tim Williams
On 23/08/07, Tim Williams <[EMAIL PROTECTED]> wrote: > On 23/08/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> 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 fil

Re: Using Regular Expresions to change .htm to .php in files

2007-08-23 Thread Tim Williams
On 23/08/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> 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 ab