context: https://stackoverflow.com/a/47348104/15603477
printf -v pasteargs %*s 16
paste -d\ ${pasteargs// /- } < <(seq 1 42)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
33 34 35 36 37 38 39 40 41 42
paste -d, --delimiters=LIST reuse characters from LIST instead of TABs
${parameter/pattern/string}
The pattern is expanded to produce a pattern just as in filename expansion. Parameter is expanded and the longest match of pattern against its value is replaced with string. The match is performed according to the rules described below (see Pattern Matching). If pattern begins with ‘/’, all matches of pattern are replaced with string.
after checked with manual.
- what does
${pasteargs// /- }
do. - I do know
%s
refers toprintf
argument. But%*s 16
I don't know. - Even I quoted manual, still not sure
paste -d\