One line of shell code. 1. find at least one line of xml files containing the mysql string, and sort the C code find-typef-iname & quot; * xMl & quot; in descending order according to the number of occurrences; | xargsgrep-cmysql | grep-v & quot;: 0 $ & quot; | sort-t:-k2 a line of shell code to solve the problem 1. find at least one line of xml files containing the string mysql, and sort the C code find in descending order of the number of occurrences. -type f-iname "*. xMl "| xargs grep-c mysql | grep-v": 0 $ "| sort-t:-k 2-nr C code find. -type f-regex ". + xml "-exec grep-l mysql {}\; | xargs grep-c mysql | sort-t:-k 2-nr 2. count the number of repeated occurrences in the second column String C code awk-F "#" '{print $2}' source.txt | sort | uniq-c | sort-nf | tail-n 5> ~ /PwdTop5.txt Java code awk '{print $3}' source.txt | sort | uniq-c | sort-nr | head-5>. /PwdTop5.txt & 3. calculate the top 5 C code awk-F "#" '{print $3}' source.txt | cut-d @-f 2 | sort | uniq-c | sort-nf | tail-n 5> EmailTop5.txt note: the text format in source.txt is C code AAA # BBB # CCC@foxmail.com AAB # BBC # CCD@qq.com AAC # BBD # CCE@163.com 4. output the first line of all txt files to the C code find/-name "* in the first.txt file "*. txt "-exec head-n 1 {}\; 1> first.txt 2>/dev/null & 5. find the maximum five files in the current path. -type f-exec ls-l {}\; | sort-nr-k 5 | head-n 5 6. count the size of all jpg files C code find/-name "*. jpg "-exec wc-c {}\; | awk '{print $1}' | awk '{a + = $1} END {print a}' 7. rename the aaa part of all non-jpg and JPG files in PATH to bbb part C code find $ PATH-type f-print | grep-v ". *\. \ (jpg \ | JPG \) "| xargs sed-I" s/aaa/bbb/g"
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