I want to be able to sort the output from the grep -rc
command,
I am currently using the command:
grep -rc "Pattern" . | sort -t: -rk2,2n
however the list is still sorted from low to high, instead of high to low... it also prints out the exact output when using:
grep -rc "Pattern" . | sort -t: -k2,2n
So what I want is for the outputs:
data_x:12
data_y:34
data_z:56
data_a:205
data_b:1003
to be sorted into
data_b:1003
data_a:205
data_z:56
data_y:34
data_x:12
grep -rc "Pattern" . | sort -t: -k2,2rn