Friday, May 24, 2019

Transposing delimited data?

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



--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20190524151143.68ad9f93%40bigbox.christie.dr.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment