All pastes #798016 Raw Edit

Anonymous

public text v1 · immutable
#798016 ·published 2007-11-26 14:45 UTC
rendered paste body
#!/bin/sh


ALIGN[1]="left"
ALIGN[2]="left"
ALIGN[3]="left"
ALIGN[4]="left"
ALIGN[5]="left"
ALIGN[6]="left"
function kiertekel() {
        if [ `echo $1 | grep -i "thead_align" | wc -l` -gt 0 ]; then
                ROWIDX=1

                echo $1 | sed "s/<thead_align>//i" | tr "${SEPARATOR}" " " | while read CELLA; do
                        echo ${CELLA}
                        ALIGN[${ROWIDX}]=${CELLA}
                        ROWIDX=$((ROWIDX + 1))
                done

                return

        elif [ `echo $1 | grep -i "title" | wc -l` -gt 0 ]; then
                echo "title"
        fi

        ROWIDX=1

        echo $1 | sed "s/${SEPARATOR}/\n/g" | while read CELLA; do
                echo "<td align=\"${ALIGN[${ROWIDX}]}\">${CELLA}</td>\n"
                ROWIDX=$((ROWIDX + 1))
        done
}

cat $1 | while read SOR; do


        echo "<tr>\n"

        kiertekel "${SOR}"

        echo "</tr>\n";
done