Recent linux commands grep, awk, cut, uniq, wc practical application examples

Source: Internet
Author: User


Recently learned linux commands grep, awk, cut, uniq, wc. The actual application example shows the number of players who use commands every day: www.2cto.com gzip-c-d nohup. out. 'date + % Y % m % d '*. gz | grep/web/api/logic/logicDispatcher | awk '{FS = "&"; print $2 ;}' | awk' {FS = "= "; print $2;} '| cut-d ''-f3 | cut-d'/'-f2 | sort | uniq | wc-l resolution: gzip-c-d nohup. out. 'date + % Y % m % d '*. gz decompress the zip file, but keep the zip file. Output It To The grep/web/api/logic/logicDispatcher console to find the row awk with the keyword '{FS = "&"; print $2;} 'returns the awk account according to the format & {FS = "="; print $2 ;} 'separate accounts by format = '| cut-d'-f3 | cut-D'/'-f2 | sort the first two or three characters of the account in uniq order | wc -l retrieve the unique, then, query the FA and FB usage by Count gzip-c-d nohup. out. 'date + % Y % m % d '*. gz | grep cmd = fa | wc-lgzip-c-d nohup. out. 'date + % Y % m % d '*. gz | grep cmd = fb | wc-l query the amount of game coins consumed by FB grep ___ 23 ___ logs/logclient. log_201211 * | awk '{FS = "_"; all + = $12-$15; print $5, $12, $15, $12-$15, all ;} 'query the total number and type of dropped items grep logGiftItemBymobile logs/logclient. log _ 'date + % Y % m % d '. log | grep consume. refreshtavern.1 | wc-lgrep logGiftItemBymobile logs/logclient. log _ 'date + % Y % m % d '. log | grep hero. reset.1 | wc-lgrep logGiftItemBymobile logs/logclient. log _ 'date + % Y % m % d '. log | grep consume.1.a | wc-lgrep logGiftItemBymobile logs/logclient. log _ 'date + % Y % m % d '. log | grep player. box. gambling.3 | wc-lgrep logGiftItemBymobile logs/logclient. log _ 'date + % Y % m % d '. log | grep player. queue. building | wc-lgrep logGiftItemBymobile logs/logclient. log _ 'date + % Y % m % d '. log | grep equipment. tech. upgrade. book1 | wc-lgrep logGiftItemBymobile logs/logclient. log _ 'date + % Y % m % d '. log | grep enhanced. star.1 | wc-lgrep logGiftItemBymobile logs/logclient. log _ 'date + % Y % m % d '. log | grep enhanced. star.2 | wc-l
 

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.