Comment by father_of_two
11 years ago
seq has the -s flag which voids the need of the paste for that command:
$ seq -s + 10 20
10+11+12+13+14+15+16+17+18+19+20
But I agree that the paste is very useful.
# a few random samples for an IN SQL statement
$ shuf -i 1-500000 -n 5 | paste -s -d ,
371492,250061,266669,455846,295852
# we can even get PI
$ ( seq -s + -f '4/%g' 1 4 100000 && seq -s - -f '4/%g' 3 4 100000 ) | paste -s -d - | bc -l
3.14157265358979523735
There is a faster way to get pi in bc:
(That is, 4×arctan(1)=4×π/4=π.) But your way is truly an awesome use of Unix!