Main

Projects

Articles

Thanos K - aka DJ Art

a humble webspace about linux and technology

iso2html

Gawk/bash Script for adding the iso-8859-7 tag in linuxdoc html-generated files

#!/bin/bash if [ $# -le 1 -o $# -ge 3 ] then echo "Iso2Html version 0.21" echo "USAGE: iso2html input_file(w/o extension!!) n" echo "" echo " Replace n with the number of the last page that sgml2html " echo "created. For example, if you have run 'sgml2html index.sgml' " echo "and you got index.html, index-1.html, index-2.html and " echo "index-3.html, then replace n with 3." echo "" echo "NOTICE: As input_file use *ONLY* the name of your document " echo "WITHOUT its extension (don't use filename.html). i.e. In the " echo "above example, the correct syntax is 'iso2html index 3'." echo "" echo "For comments, reports, bugs, etc. please contact with" echo "DJ Art (aka Kyritsis Athanasios) at djart@hellug.gr" echo "" else if [ ! -d iso2htmldir ] then mkdir iso2htmldir echo "o Creating iso2html directory" fi gawk '{if (NR <=3 ) print $0 }' $1.html > iso2htmldir/$1.html echo '<META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=iso-8859-7">' >> iso2htmldir/$1.html gawk '{if (NR >=4) print $0 }' $1.html >> iso2htmldir/$1.html i=0 while [ $i -lt $2 ] do i=`expr $i + 1` gawk '{if (NR <=3 ) print $0 }' $1-$i.html > iso2htmldir/$1-$i.html echo '<META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=iso-8859-7">' >> iso2htmldir/$1-$i.html gawk '{if (NR >=4) print $0 }' $1-$i.html >> iso2htmldir/$1-$i.html done mv -f iso2htmldir/* . echo "o Moving files back to original directory" rm -rf iso2htmldir echo "o Removing iso2html directory" fi