i am using this script that read the file and show me the unique Name from the file and also show me how many times this Name exist(number of count) in the file
john
john
William
wad
William
john
wad
john
wad
john
William
john
wad
john
wad
wad
john
john
cat student.txt | awk '{print $1}' | sort | uniq -c | sort -nr | head -n 10
its output:
9 John
6 Wad
3 William
i want to change this format, i want first Name then Number of count, how can i do this with above script
John 9
Wad 6
William 3