bt707
asked on
AWK command & SORT
I have a command I use like this:
awk ' /refused/ {print $6, $7, $16, $17,$18}' log_file1 | sort | uniq -c
It works fine but when it prints out each line with the number of times that line occured in the file I want it to do a sort on the number of times it occured in the file.
I want the ones that occured in the file the most to be on top and sorted desending down, I wanted to pipe this command back to sort but can't find a way to sort
the number of occurances, I'm sure this can be done but can't find a way to do it.
Thanks,
awk ' /refused/ {print $6, $7, $16, $17,$18}' log_file1 | sort | uniq -c
It works fine but when it prints out each line with the number of times that line occured in the file I want it to do a sort on the number of times it occured in the file.
I want the ones that occured in the file the most to be on top and sorted desending down, I wanted to pipe this command back to sort but can't find a way to sort
the number of occurances, I'm sure this can be done but can't find a way to do it.
Thanks,
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Oops, gripe just got it.
Wesly
Wesly
ASKER
Thanks gripe, that's what i was looking for.
Thanks again
Thanks again
awk ' /refused/ {print $6, $7, $16, $17,$18}' log_file1 | sort -nr | uniq -c
Wesly