Consider this usage of rs(1)
:
rs -n -z -c, <<CSV
a,b,c
dd,ee,ff
CSV
The above snippet emits:
a b c dd ee ff
But I was expecting to see something like this:
a b c
dd ee ff
The manual suggests that the output array shape should match the input array shape unless configured otherwise.
rs -h
using the same input emits 2 3
, which suggests that rs
does correctly identify the input array shape.
What am I misunderstanding in the usage of rs
? Is there a way to have it automatically format the output with the same shape as the input?
-T
(pure transpose) then piping the result through a secondrs -T
seems to work for mers
question butcolumn -s, -t <<CSV ...
does what you want.column
when a leading cell is "blank", which is how I foundrs
in the first place! I made a follow-up question about it: unix.stackexchange.com/q/733969/73256rs
has the same problem ascolumn
in that example! It's a little surprising that these basic tools behave so weirdly. I'm tempted to write my own AWK script and ignore all these.rs
is used to reshape data. It seems that you don't actually want to reshape the data, which in turn meansrs
might be the wrong tool for the job.