Skip to content

Instantly share code, notes, and snippets.

@natebass
Last active August 29, 2015 14:12
Show Gist options
  • Save natebass/5ec2fef087d26d8226fd to your computer and use it in GitHub Desktop.
Save natebass/5ec2fef087d26d8226fd to your computer and use it in GitHub Desktop.
Format data into Github Markdown tables
awk -F' ' '
BEGIN {
FIRST_COL_LENGTH = 4;
SECOND_COL_LENGTH = 80;
THIRD_COL_LENGTH = 35;
printf("|%4s|%80s|%35s|\n", "Key", "Action", "Followed By")
printf("|")
for (i=0; i<FIRST_COL_LENGTH; i++) {
printf("-");
}
printf("|")
for (i=0; i<SECOND_COL_LENGTH; i++) {
printf("-");
}
printf("|")
for (i=0; i<THIRD_COL_LENGTH; i++) {
printf("-");
}
printf("|\n")
}
{
printf("|%-4s|%80-s|%-35s|\n", $1, $2, $3)
}' vi_default_complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment