Sep 18, 2007

Convert string to html table

#!/bin/sh
sed -e '/^[A-Za-z0-9]*[^\:]$/{
d
}' < source_file > tmp_file
echo "<table>" > destination_file.html
sed -e '/:/{
s/^/<tr><td>/g
s/\:/<\/td><td>/g
s/$/<\/td><\/tr>/g
}' < tmp_file >> destination_file.html
echo "</table>" >> destination_file.html

No comments: