3 ms·
By the way, I was recently surprised by a similar pattern in linux, where you can do: (echo -e "one\ntwo\nthree\nfour") | paste -d, - - to get result of:
by akavel 13y ago
By the way, I was recently surprised by a similar pattern in linux, where you can do:
(echo -e "one\ntwo\nthree\nfour") | paste -d, - -
to get result of:
one,two
three,four
by exploiting a similar trick, i.e. reading two times ('- -') from the same iterator (STDIN of 'paste')
- apw 13y agoThanks for posting this. For reference, paste is a standard UNIX utility, whose purpose is to do all sorts of useful things not limited to 2-tuples: $ seq 1 9 | paste - - - 1 2 3 4 5 6 7 8 9
- tambourine_man 13y agoNo need for parentheses, echo -e "one\ntwo\nthree\nfour" | paste -d, - - works just fine