I have a really long command that runs over a huge file and I am forced to run it twice which doubles the time it takes to run.
This is what I am doing at the moment:
x=$(command | sort -u) y=$(command | sort -n)
I was wondering whether there is any way to redirect the output of command to both
sort -u and
sort -n and store output of each into separate variables or files like I did above with
I tried to use tee to do the following but no luck:
command | tee >(sort -n > x.txt) >(sort -u > y.txt)
I tried to redirect output to text files but it just printed it to standard output instead.
Any tips or ideas?