Skip to content

Instantly share code, notes, and snippets.

@orymate
Created May 30, 2012 10:37
Show Gist options
  • Save orymate/2835403 to your computer and use it in GitHub Desktop.
Save orymate/2835403 to your computer and use it in GitHub Desktop.
transpose csv file
#!/usr/bin/awk -f
BEGIN{FS=";"}
{a[i++] = $0; max = max > NF ? max : NF}
END{
for (i = 1; i <= max; i++) {
for (j in a) {
$0 = a[j]
printf "%s%s", $i, FS
}
print ""
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment