Link to home
Start Free TrialLog in
Avatar of bt707
bt707Flag for United States of America

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,
ASKER CERTIFIED SOLUTION
Avatar of gripe
gripe

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Put -nr for sort:
awk ' /refused/ {print $6, $7, $16, $17,$18}' log_file1 | sort -nr | uniq -c

Wesly
Oops, gripe just got it.

Wesly
Avatar of bt707

ASKER

Thanks gripe, that's what i was looking for.

Thanks again