What do you and the original poster hope to achieve by
...| sort -g | uniq | sort -g
The second sort is doing nothing. And sort can do uniq, saving time and I/O. $ (seq 10; seq 5) | shuf | sort -gu | fmt
1 2 3 4 5 6 7 8 9 10
$