Last active
August 29, 2015 14:12
-
-
Save natebass/5ec2fef087d26d8226fd to your computer and use it in GitHub Desktop.
Format data into Github Markdown tables
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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