#! /bin/sh # replace ginette by a sequence like # ginette # we have to deal with the path of ginette.html ... # # see call in savesaxo.sh # # update : # $Id$ # fplod 2007-03-20T14:02:14Z aedon.locean-ipsl.upmc.fr (Darwin) # creation # set -u output=${1} # ++ parameter # # first find all files containing .. list_html_pro=$(find ${output} -name "*.html" -exec grep -l ".*" {} \;) if [ "${list_html_pro}" = " " ] then echo "iii : no .. in html files" else for file_html in ${list_html_pro} do fpath=$(dirname ${file_html} | sed -e "s+\(${output}/\)\(.*\)+\2+") list_llink=$(grep -n ".*" ${file_html} | awk -F ":" '{print $1}') # ++ repérer si plusieurs .* par ligne # ++ sortir en erreur si c'est le cas for line in ${list_llink} do # replace something by #something # module is the html file name to be used module=$(sed -ne "${line},${line}p" ${file_html} | \ grep ".*" | \ sed -e "s+\(.*\)\(.*\)\(.*\)+\\2.html+") modulemin=$(echo ${module} | tr "[:upper:]" "[:lower:]" ) # lpath is the path on module relatively to the location of # the html file containing the .. lpath=$(find ${output} -name "${modulemin}") # ++ repérer si doublons # ++ sortir en erreur si c'est le cas if [ "${lpath}" = "" ] then echo "eee : path of ${modulemin} not found under ${output}" echo "eee : ${module} is used in ${file_html}" else lpath=$(dirname ${lpath} | sed -e "s+\(${output}/\)\(.*\)+\2+") #echo "path du fichier html ${fpath}" #echo "lpath ${lpath}" if [ "${lpath}" = "${fpath}" ] then relpath="./" else nblev=$(echo ${fpath} | sed -e "s@/\$@@" | awk -F "/" '{print NF}') # nblev=$(( ${nblev} + 1)) relpath="" ilev=1 while [ ${ilev} -le ${nblev} ] do relpath="${relpath}../" ilev=$(( ${ilev} + 1 )) done relpath=${relpath}/${lpath} fi #echo "relpath ${relpath}" sed -e "${line}s+\(\)\(.*\)\(\)+\2+" \ ${file_html} > ${file_html}_modify mv ${file_html}_modify ${file_html} fi done done fi exit 0