20: Words and letters to re-order cases

Source: Internet
Author: User

Use the shell to handle the following:

1, according to the frequency of word occurrence descending sort!

2, in descending order by the frequency of letters!

The Squid project provides a number ofresources to assist users design,implement and support squid installations. Please browse the documentation and support sections for more Infomation,byoldboy training.

An enterprise Shell interview exam question in the classroom

http://oldboy.blog.51cto.com/2561410/1686891

Answer:

[[email protected] scripts]# cat Paixu.txt|xargs-n1|awk ' {aa[$1]++} end{for (i in AA) print I,aa[i]} ' |sort-rnk2
Support 2
Squid 2
and 2
Users 1

 [[email protected] scripts]# egrep -o  [a-z]   " Paixu.txt|awk  "  {aa[$1]++} end{for (J In AA) print J,aa[j]}   " | sort -rnk2s  19  e  17  o  16  t  14  n  12  i  12  r  11  

20: Words and letters to re-order cases

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.