Created
August 21, 2014 19:16
-
-
Save mdunsmuir/0ebdca2bb6c25e79773f to your computer and use it in GitHub Desktop.
transpose a file shell one-liner
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
#!/bin/sh | |
ruby -e 'lines=IO.readlines(ARGV.shift);l=lines.map(&:length).max;puts lines.map{|s|sprintf("%-#{l}s",s.strip).chars}.transpose.map(&:join).join("\n")' $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment