Transposing delimited data?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Transposing delimited data?

Tim Chase
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 [hidden email].
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.
Kit
Reply | Threaded
Open this post in threaded view
|

Re: Transposing delimited data?

Kit
https://github.com/salsifis/vim-transpose
--
Kit



2019-05-24 22:11 GMT+02:00, Tim Chase <[hidden email]>:

> 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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAAVKVq_xn4WHdiCjb-mSMFwy-FsknyS4AZwd_fq_FNf%3Dvnh27w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.