{"id":37128,"date":"2022-09-23T16:37:11","date_gmt":"2022-09-23T20:37:11","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=37128"},"modified":"2022-09-23T16:37:11","modified_gmt":"2022-09-23T20:37:11","slug":"reshaping-text-with-rs","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2022\/09\/23\/reshaping-text-with-rs\/","title":{"rendered":"Reshaping Text With rs"},"content":{"rendered":"<p><a href=\"https:\/\/leancrew.com\/all-this\/2022\/09\/reshaping-text\/\">Dr. Drang<\/a>:<\/p>\n<blockquote cite=\"https:\/\/leancrew.com\/all-this\/2022\/09\/reshaping-text\/\">\n<p>The problem was that the lists were long. One had 84 items and the other had 30. Pasting them into the message in the form I had them&mdash;one item per line&mdash;would take up too much space. Pasting them in as a comma-separated series&mdash;which I could convert them to with a simple search-and-replace&mdash;would be very hard to read. What I wanted was nicely formatted set of rows and columns that would be easy to read without taking up too much space.<\/p>\n<p>[&#8230;]<\/p>\n<p>After some Googling, I came across <a href=\"https:\/\/askubuntu.com\/questions\/859820\/how-to-print-values-in-a-text-file-to-columnated-file-using-shell-script\">this Ask Ubuntu question<\/a>, which led me to <code>rs<\/code>, an old <a href=\"https:\/\/en.wikipedia.org\/wiki\/Berkeley_Software_Distribution\">BSD<\/a> command that comes installed on macOS. The name stands for &ldquo;reshape,&rdquo; and it will take any row\/column set of data and rearrange it into a different number of rows and columns.<\/p>\n<\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Dr. Drang: The problem was that the lists were long. One had 84 items and the other had 30. Pasting them into the message in the form I had them&mdash;one item per line&mdash;would take up too much space. Pasting them in as a comma-separated series&mdash;which I could convert them to with a simple search-and-replace&mdash;would be [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2022-09-23T20:37:13Z","apple_news_api_id":"5fee5cf9-471b-49d2-8d3f-9f43fbb380d6","apple_news_api_modified_at":"2022-09-23T20:37:13Z","apple_news_api_revision":"AAAAAAAAAAD\/\/\/\/\/\/\/\/\/\/w==","apple_news_api_share_url":"https:\/\/apple.news\/AX-5c-UcbSdKNP59D-7OA1g","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[2],"tags":[30,2077,163],"class_list":["post-37128","post","type-post","status-publish","format-standard","hentry","category-technology","tag-mac","tag-macos-12","tag-unix"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/37128","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=37128"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/37128\/revisions"}],"predecessor-version":[{"id":37129,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/37128\/revisions\/37129"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=37128"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=37128"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=37128"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}