Transposing delimited data?

9 views
Skip to first unread message

Tim Chase

unread,
May 24, 2019, 4:11:58 PM5/24/19
to v...@vim.org
I know this sounds weird to attempt in vi/vim, but after about the
5th time I've wanted to do it, I figured I'd at least ask if someone
had brilliant ideas. It's usually a copy/paste of some tab-delimited
output and its headers, and I'd like to transpose it so that each
column becomes a row:

[====input====]
Name Age Weight
John 35 200
Amy 42 120
Pat 22 165

[====output====]
Name John Amy Pat
Age 35 42 22
Weight 200 120 165


When I'm on my BSD boxes, I have rs(1) so can

:%! rs -T -c -C

but on my other machines (Linux & Windows), I don't have rs(1) at
hand.

Thanks for any ideas,

-tim



Kit

unread,
May 24, 2019, 4:20:30 PM5/24/19
to vim...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages