I tried to do it in a sample text file. I use awk to sort the text file and echo to an output file. When i check the output file it doesn't print in new line but in 1 line. I got 3 line of text in the file. Here is my echo .
Code:
echo $(awk '{ print $1 }' $File | sort | uniq -c | sort -nr) > $Output