>> It would still have to be done by hand -- you could do a global change on
>> .HTML to .html ... but for the file names themselves - you'd have to
>> highlight, then select "change case" -- maybe you could write a macro to do
>> that.
>>
>> >>Its the references inside each HTML document that are the problem.
>> >>The only solution I have to date is the manual one, but as there
>> >>are about 300 pages I am not too excited at the prospect. Does anyone
>> >>have a better idea?
>
>Perl, perl, perl. A simple script that finds all SRC or A HREF or A
>NAME tags, takes their contents, lowercases them and puts 'm back. My
>perl's a bit rusty so I'm not going to actually post the code, but it
>should be, like, 5 lines of code.....
>
>Should even be possible with some 'perl -pi -e .... ' one-line
>command.


    perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html



which says:


    perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html
                                              ^^^^^^
for every file in this directory whose extension is '.html',


    perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html
           ^^^^^
create a backup copy (with the extension '.bak'), then write the output of
this command back into the original file.   the official term for this is
"in-place editing", hence the 'i'.


    perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html
         ^^
loop through the file one line at a time, printing the results of the
command (technically, the contents of the "$_" internal variable) before
going on to the next line.


    perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html
                 ^^
decide what to print (and thus write back into the file) by executing the
string which follows.   and that string says:


    perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html
                     ^
perform a substitution


    perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html
                                          ^
for every occurrence of a matching string (not just the first, as is the
default), which makes this a 'global' search & replace function.


    perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html
                                         ^
ignore case when looking for items that match the target pattern.


    perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html
                        ^^^^^^
the pattern we're looking for starts with the string 'href="'


    perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html
                              ^^
followed by any number of characters, of any kind,


    perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html
                                ^^
up to the next '"' mark.


    perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html
                       ^          ^
when you find a string of that type, remember it (store it in a temporary
variable named "$1")


    perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html
                                    ^^^^
and replace it with a copy of itself, converted entirely to lowercase.




after running that, all your URLs should be converted to lowercase in the
original files, but the backups contain original versions of each file.
if something goes wrong, you can back up and start again.   if the command
did what you wanted, you can delete all the backup files and be done with
it.






mike stone  <[EMAIL PROTECTED]>




____________________________________________________________________
--------------------------------------------------------------------
 Join The Web Consultants Association :  Register on our web site Now
Web Consultants Web Site : http://just4u.com/webconsultants
If you lose the instructions All subscription/unsubscribing can be done
directly from our website for all our lists.
---------------------------------------------------------------------

Reply via email to