[root@localhost oldboy]# cat file
the squid project provides a number of resources toassist users design,implement and support squid installations. Please browsethe documentation and support sections for more infomation
[root@localhost oldboy]# cat .sh
#!/bin/bash
cat file|
while read line
do
for i in `seq ${#line}`
do
a=`echo $line|cut -c $i`
echo "$a" >> zimu.txt
done
done cat zimu.txt|sed -r 's/[ \t]+//g'|grep -v ^$|sort|uniq -c |sort -nr
[root@localhost oldboy]# bash .sh
s
e
o
t
n
i
r
a
u
p
d
m
l
c
f
q
h
b
w
v
P
j
g
.
,
[root@localhost oldboy]#
[root@localhost oldboy]# cat file|awk 'BEGIN{FS=""}{for(i=1;i<=NF;i++){if($i!=" "){a[$i]++}}}END{for(i in a){print i,a[i]}}'|sort -nr -k
s
e
o
t
n
i
r
a
u
p
d
m
l
c
f
q
h
b
w
v
P
j
g
.
,
[root@localhost oldboy]#

shell脚本,按字母出现频率降序排序。的更多相关文章

  1. 用shell处理以下内容 1、按单词出现频率降序排序! 2、按字母出现频率降序排序! the squid project provides a number of resources toassist users design,implement and support squid installations. Please browsethe documentation and support

    此题目有多种解法,sed.awk.tr等等,都可以解决此题,命令运用灵活多变. 编写shell脚本no_20.sh 解法1: #!/bin/bash ###-------------CopyRight ...

  2. shell脚本,按单词出现频率降序排序。

    [root@localhost oldboy]# cat file the squid project provides a number of resources toassist users de ...

  3. 自定义Map.Entry的Comperator实现字符频率降序排序

    leetCode (#451,middle) java实现 class Solution { public String frequencySort(String s) { Map<Charac ...

  4. java算法面试题:有一个字符串,其中包含中文字符、英文字符和数字字符,请统计和打印出各个字符的个数 按值的降序排序,如果值相同则按键值的字母顺序

    package com.swift; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; publi ...

  5. 怎么实现元素ol的降序排序显示

    首先介绍一下什么是ol元素.这里直接引用MDN里面的定义:The HTML <ol> Element (or HTML Ordered List Element) represents a ...

  6. c++ sort降序排序

    sort是c++ STL中提供的一个函数模板,可以用来对多种类型进行排序. 默认是升序排序.它有两种使用方法: default (1) template <class RandomAccessI ...

  7. 现在输入 n 个数字, 以逗号, 分开; 然后可选择升或者 降序排序;

    /* 现在输入 n 个数字, 以逗号, 分开: 然后可选择升或者 降序排序: */ import java.util.*; public class bycomma{ public static St ...

  8. java数组降序排序之冒泡排序

    import java.util.Arrays;//必须加载 class Demo{ public static void main(String []args){ int[] arr={3,54,4 ...

  9. 通过orderby关键字,LINQ可以实现升序和降序排序。LINQ还支持次要排序。

    通过orderby关键字,LINQ可以实现升序和降序排序.LINQ还支持次要排序. LINQ默认的排序是升序排序,如果你想使用降序排序,就要使用descending关键字. static void M ...

随机推荐

  1. NITACMOJ144稳定串

    点我>>题目链接 稳定串 Time Limit: 1000ms Memory Limit: 65536KB 64-bit integer IO format: %lld      Java ...

  2. Python decorate 函数

    1. decorate 函数需要在 "@wrap" 之前定义, 否则会报错

  3. 浅谈Nginx服务器的内部核心架构设计

    前言 Nginx 是一个 免费的 , 开源的 , 高性能 的 HTTP 服务器和 反向代理 ,以及 IMAP / POP3代理服务器. Nginx 以其高性能,稳定性,丰富的功能,简单的配置和低资源消 ...

  4. DB2 错误 54001

    DB2 语句太长或者太复杂 SQLSTATE=54001 对数据库的参数的修改: db2 update db cfg for DB_NAME using STMTHEAP 4096 db2 updat ...

  5. go语言的特点

    Go语言保证了既能到达静态编译语言的安全和性能,又达到了动态语言开发维护的高效率 ,使用一个表达式来形容Go语言:Go = C + Python , 说明Go语言既有C静态语言程 序的运行速度,又能达 ...

  6. 03.Javascript——入门一些方法记录之Map和Set

    JavaScript的默认对象表示方式{}可以视为其他语言中的Map或Dictionary的数据结构,即一组键值对. 但是JavaScript的对象有个小问题,就是键必须是字符串.但实际上Number ...

  7. 将GitLab上面的代码克隆到本地

    1.安装GitLab客户端 2.去GitLab服务端找项目路径 3.去GitLab客户端去克隆代码 右键-->git Clone 4.最后结果

  8. Spring Boot常用配置

    概述 本文主要写了下Spring Boot的一些常用配置. Spring Boot基本配置 入口类: Spring Boot通常有一个名为*Application的入口类,入口类里面有一个main方法 ...

  9. .net 键盘

    private void txtGoodsGroup_KeyPress(object sender, KeyPressEventArgs e) { base.OnKeyPress(e); if ((i ...

  10. arcgis jsapi接口入门系列(1):地图

    地图相关 //地图相关demo mapFun: function () { //获取地图中心点 let center = this.mapView.center; //地图中心点坐标(同地图坐标系) ...