Hacker News new | past | comments | ask | show | jobs | submit login
Reshaping Text (leancrew.com)
67 points by zdw on Sept 25, 2022 | hide | past | favorite | 7 comments



Another option is `pr` command:

    $ seq 15 | pr -3ts
    1       6       11
    2       7       12
    3       8       13
    4       9       14
    5       10      15

    $ seq 15 | pr -3ats
    1       2       3
    4       5       6
    7       8       9
    10      11      12
    13      14      15
One difference is that you'll need `6` instead of `14` for the example in the article. The `-j` option of `rs` is cool.


my old colleague at the California Digital Library John Kunze wrote `rs` when he was at Berkeley, as well as `jot` and `lam`. These were inspired by the APL operators. https://jkunze.github.io/biography.html


FWIW, if you could get almost the same effect from google docs (and presumably excel): if you cut/copy a grid of cells and paste it into something that only understands text (e.g. VScode) you'll get tab-delimited columns of text. I don't know if there's a way to get some of the niceties like left aligning but I've used google docs for this sort of trick many times.

  1 5 9
  2 6 10
  3 7 11
  4 8 12


Dammit it's very hard to go a day without getting a very high ROI from reading HN.


One issue I've encountered in the past when using text formatted with hard wrapping with non-technical people is that presenting the information usually goes fine, but when they want to edit the text a bunch of headaches ensue, since they don't use editors that reflow line endings or maintain spacing that would only be clearly visible in a monospace context.


> Note that the number used for the gutter size has to come immediately after the -g. You can’t leave a space between the option and its argument as you can with many other commands.

I’ve seen this a few times. Why is that? Is there some syntactic ambiguity?


I'm not on my laptop atm ... How do these compare to the column command on linux?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: