Computing.Net > Forums > Unix > Sort and count in bourne shell

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Sort and count in bourne shell

Reply to Message Icon

Name: pnxi
Date: September 7, 2003 at 20:29:45 Pacific
OS: Unix
CPU/Ram: Intel
Comment:

Hi, I am a newer in Bourne shell. I have a log file which contain many lines(information about file used), now I want to count the 10 most requested files in the log, and display the 10 in descending order.
I don't know how to count the duplicate files and sort them in descending order, any command for that purpose? can anybody tell me how to accomplish that?



Sponsored Link
Ads by Google

Response Number 1
Name: David Perry
Date: September 8, 2003 at 04:25:13 Pacific
Reply:

If you are talking about monitoring web traffic, there are plenty of log analyzing tools already.

sort -u will give you unique results although you would want to only look at the portion of each log entry to would give you a unique result, ie exclude the date/time stamp and who asked for the file. awk will help you look at portions of a line. grep -c will give you a count of occurances. sort -n -r will sort numerically in decending order.


0
Reply to Message Icon

Related Posts

See More


SCO Openserver Licence Cronatb, Display and xhos...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Sort and count in bourne shell

go to in bourn shell www.computing.net/answers/unix/go-to-in-bourn-shell/5103.html

Array in Bourne Shell www.computing.net/answers/unix/array-in-bourne-shell/4972.html

Test file Open in Bourne Shell scrp www.computing.net/answers/unix/test-file-open-in-bourne-shell-scrp/4752.html