Skip to content

Instantly share code, notes, and snippets.

@dmerand dmerand/
Created May 2, 2012

What would you like to do?
Convert TSV file to HTML snippet
#convert a TSV file to an HTML file
#author: Donald L. Merand
#note: this is most useful in conjunction with bcat, which sends results to the browser
# you can get bcat on OS X using homebrew
# then type "brew install bcat"
#also note: this script only creates an HTML snippet - you'll probably want to wrap
# it in some pretty CSS, not to mention <html> and <body> tags
#convert Mac line endings, if any
perl -p -e 's/\r/\n/g' |
#now do the conversion
awk '
printf "<table>\n"
printf "\n\n<tr>"
for (i=1;i<=NF;i++) {
printf "<td>%s</td>", $i
printf "</tr>"
printf "\n</table>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.