rs: Reshape tabular data
The utility rs
can reshape a list of data points into a table for cleaner presentation:
seq 7 | rs 0 2
= reshape list of data into N rows of 2 columnsseq 7 | rs 4 0
= reshape list of data into 4 rows of N columnsseq 7 | rs 4 3
= reshape list of data into 4 rows of 3 columns (including blank entries)
It can handle input separators and can reshape its own output:
seq 7 | paste - - | rs -c 0 3
= reshape tab separated valuesseq 7 | rs 0 2 | rs 4 0 | rs 2 0
= reshape into 2 rows of N columns (finally)
It can right justify the data:
jot 6 0 1000 | rs -j 0 2
= right justify into 2 columns
This is like combining paste
with column -t
but more targeted and flexible.
Published on: 07 Jun 2023