shell - How to sort a 3G bytes access log file? -


hi all: have 3g bytes tomcat access log named urls, each line url. want count each url , sort these urls order number of each url. did way:

awk '{print $0}' urls | sort | uniq -c | sort -nr >> output 

but took long time finish job, it's took 30 minutes , still working. log file bellow:

/open_api/borrow_business/get_apply_by_user /open_api/borrow_business/get_apply_by_user /open_api/borrow_business/get_apply_by_user /open_api/borrow_business/get_apply_by_user /loan/recent_apply_info?passportid=y20151206000011745 /loan/recent_apply_info?passportid=y20160331000000423 /open_api/borrow_business/get_apply_by_user ... 

is there other way process , sort 3g bytes file? in advance!

i'm not sure why you're using awk @ moment - it's not doing useful.

i suggest using this:

awk '{ ++urls[$0] } end { (i in urls) print urls[i], }' urls | sort -nr 

this builds count of each url , sorts output.


Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -