9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Richard Miller <9fans@hamnavoe.com>
To: 9fans@9fans.net
Subject: Re: [9fans] rows to cols?
Date: Fri, 13 Nov 2009 08:44:15 +0000	[thread overview]
Message-ID: <18087f99b33ebe5fbec227e86218045e@hamnavoe.com> (raw)
In-Reply-To: <e56a31560911122339v5cd82d27g46b82737fcb1eaa0@mail.gmail.com>

> Is there an easy way to transpose the text so that rows become
> columns, and vice versa? Delimiter is space.

If you know in advance the number of rows & colums, it's easy:

term% cat t
one two three four
five six seven eight
nine ten eleven twelve
term%  tr -s ' ' '\xA' <t | pr -t -3 -l4 | tr -s ' ' ' '
one five nine
two six ten
three seven eleven
four eight twelve




  reply	other threads:[~2009-11-13  8:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-13  7:39 Peter A. Cejchan
2009-11-13  8:44 ` Richard Miller [this message]
2009-11-13  9:36   ` Tharaneedharan Vilwanathan
2009-11-13 23:53   ` dave.l
2009-11-14  9:43     ` Richard Miller
2009-11-14 11:27       ` dave.l
2009-11-14  4:43 ` Lyndon Nerenberg (VE6BBM/VE7TFX)
     [not found] <<372549f4a1e93be164e3f5016203c1c3@yyc.orthanc.ca>
2009-11-14 15:11 ` erik quanstrom
2009-11-14 23:23   ` Lyndon Nerenberg (VE6BBM/VE7TFX)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=18087f99b33ebe5fbec227e86218045e@hamnavoe.com \
    --to=9fans@hamnavoe.com \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).