A comprehensive example of basic File Processing

Source: Internet
Author: User

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

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.