Tux on VM

Last updated on:
Sunday, July 06, 2008

Software

Information

Community

News

Fun

Credits




Valid HTML 4.01!
Linux for Big Iron

Title:
Porting HTML from Windows® to Linux
Categories/Keywords:
porting: html, rename, script
Contributors:
Mark Post
John Summerfield
Write Up By:
"Samy Rengasamy" snrsamy@yahoo.com
The shareware product HTML Rename from http://www.xlanguage.com/ will automatically fix the problem when going from Windows'® "case insensitive but case preserving" environment to Linux's case sensitive one. A lot of the file name references will not match the case of the actual files Following are the claims at the product's website:
  • Force all file names and links to be lower case
  • Remove spaces or other unwanted characters from file names and links
  • Convert filename extensions (e.g., *.jpeg -> *.jpg)
  • Convert absolute URLs to relative URLs
John Summerfield's bash script may fix some of these problems. Apparently he wrote it a few years ago to fix some broken HTML he got from IBM.
#!/bin/bash
D='/u02/java/IBM/ftp/ '
grep -ni "<a .*href=" `find ${D} -name \*.html` \
   | sed -e 's/:.*href="/|/i' -e 's/".*//' \
         -e 's/<a//' \
         -e 's/#.*//' \
         -e 's/|/ /'
   | grep '\..*\.' \
   | grep -v http: \
   | sort -u \
   | while  read source link
      do
         fd=`dirname $source`
         EF=$fd/$link
         [ -n "${link}" ] && \
            [ ! -f ${EF} ] && \
            {
               echo EF=${EF}  s=$source d=$fd l=,$link,
               AF=`find ${D} -iname ${link}`
               echo AF=${AF}
               cmd="grep -ni $link $source /dev/null"
#              echo ${cmd}
               ${cmd}
#              grep -i "$link" $source /dev/null
               echo
            }
      done
 

Site hosting courtesy of Velocity Software