Home > php教程 > php手册 > 找到文件里面出现前 n 次的单次

找到文件里面出现前 n 次的单次

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 20:12:48
Original
905 people have browsed it

#!/bin/bash end=$1 cat $2 | #文件名称 tr -cs "[a-z][A-Z]" "[\012*]" | #每个单词一行 tr A-Z a-z | #大写转换成小写 sort | #排序 uniq -c | #去重计数 sort -k1nr -k2 | #排序 head -n "$end" #输出前n 个 top ~ 原文地址:找到文件里面出现前 n 次的单

    #!/bin/bash                                                                                  
    end=$1
    cat $2 |   #文件名称
    tr -cs "[a-z][A-Z]" "[\012*]" | #每个单词一行
    tr A-Z a-z |  #大写转换成小写
    sort |  #排序
    uniq -c | #去重计数
    sort -k1nr -k2  |  #排序
    head -n "$end" #输出前n 个 top
Copy after login

~

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template