The old boy 23-stage classroom real-time investigation of an enterprise Shell interview test questions

Source: Internet
Author: User

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/71/B3/wKiom1XW4BagvgPxAAC_N_Bdskw467.jpg "title=" Qq20150821162310.png "alt=" Wkiom1xw4bagvgpxaac_n_bdskw467.jpg "/>

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 of resources to assist  users design,implement and support squid installations. please browse  The documentation and support sections for more infomation Solution:cat  Test.txt the squid project provides a number of resources to  assist users design,implement and support squid installations. please  browse the documentation and support sections for more  Infomation sorted by word: FA 1:[[email protected] ~]# awk -f  "[,.  ]"   "{for (i=1;i<= nf;i++) array[$i]++}end{for (key in array) print array[key],key| " Sort -nr "} '  oldboy.txt|column -t2  the2  support2  squid2   and1  users1 &nbSp;to1  sections1  resources1  provides1  project1  please1   of1  number1  more1  installations1  infomation1   implement1  for1  documentation1  design1  browse1   ASSIST1&NBSP;&NBSP;A1 law 2:[[email protected] ~]# tr  "[ ,.]"   "\ n" <oldboy.txt|grep -v  "^$" |sort|uniq -c|sort -rn        2 the      2 support      2  squid      2 and      1 users       1 to      1 sections       1 resources      1 provides       1 project       1 please      1 of      1  number      1 more      1  installations      1 infomation      1  implement      1 for      1  documentation      1 design      1  Browse      1 assist      1 a by alphabetical order 1[[ email protected] ~]# tr  "{ |,|.}"   "\ n" <oldboy.txt|awk -F  "   ' {for (i=1;i<=nf;i++) array[$i]++}end{for (key in  array) print array[key],key| " Sort -nr "} ' 19 s17 e16 o14 t12 n12 i11 r9 a8 u7 p7  d6 m4 l4 c3 f2 q2 h2 b1 w1 v1 p1 j1 g[[email protected] ~]# tr  "[ ,.]"   "\ n" <oldboy.txt|awk  ' {for (I=1; i<=length ($);  i++)  ++s[substr ($0,i,1)]}  End {for (a in s)  print s[a], a| " Sort -rn "} ' 19 s17 e16 o14 t12 n12 i11 r9 a8 u7 p7  D6 m4 l4 c3 f2 q2 h2 b1 w1 v1 p1 j1 g

A super-detailed case study of the awk array teaches the latest advanced OPS classes at the Old boys!

This article is from the "Old boy Linux ops" blog, please be sure to keep this source http://oldboy.blog.51cto.com/2561410/1686891

The old boy 23-stage classroom real-time investigation of an enterprise Shell interview test questions

Related Article

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.