The comprehensive example of basic file processing extracts the 100th most recent log entries (hour time, IP address, and user idleness) catrecord.txt. 114.112.53212345310: 21213.89.113.109423423410: 22202.114.112.53212345310: 23113. 8... comprehensive example of basic file processing 1. extract the most frequently-occurring 100 logs (access time, IP address, user ID) # cat record.txt 202.114.112.5 3212345310: 21 213.89.113.21 3423423410: 22 202.114.112.5 3212345310: 23 113.89.113.21 4447423710: 23 220.14.112.5 1212305310: 24. 24134738 first order is to make the same ip address adjacent to www.2cto.com # cut-d ''-f 2,3 record.txt | sort | uniq-c 1 113.89.113.21 44474237 2 202.114.112.5 32123453 1 213.89.113.21 34234234 1 limit 24134738 1 220.14.112.5 12123053 final result # cut-d ''-f 2,3 record.txt | sort | uniq-c | sort-k1nr | head-n100 2 202.114.112.5 32123453 1 113.89.113.21 44474237 1 213.89.113.21 34234234 1 219.89.13.21 24134738 1 220.14.112.5 12123053
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service