任务:report.txt文件里有以下内容:记录了一些方法的执行时间,要求按执行时间降序排列.

 void com.dustpan.zeus.core.service.MergeService.startService(int)|2
void com.dustpan.zeus.core.service.InitShopDateService.startService(int)|1
boolean com.dustpan.zeus.core.service.MergeService.executeGePrintSyncTask()|475
boolean com.dustpan.zeus.core.service.InitShopDateService.executeInitShopTask()|96
boolean com.dustpan.zeus.core.service.MergeService.executeGePrintSyncTask()|1013
boolean com.dustpan.zeus.core.service.InitShopDateService.executeInitShopTask()|184
boolean com.dustpan.zeus.core.service.MergeService.executeGePrintSyncTask()|729
boolean com.dustpan.zeus.core.service.InitShopDateService.executeInitShopTask()|14
boolean com.dustpan.zeus.core.service.MergeService.executeGePrintSyncTask()|394
boolean com.dustpan.zeus.core.service.InitShopDateService.executeInitShopTask()|90
boolean com.dustpan.zeus.core.service.MergeService.executeGePrintSyncTask()|569
boolean com.dustpan.zeus.core.service.InitShopDateService.executeInitShopTask()|796
boolean com.dustpan.zeus.core.service.MergeService.executeGePrintSyncTask()|1648
boolean com.dustpan.zeus.core.service.InitShopDateService.executeInitShopTask()|82
boolean com.dustpan.zeus.core.service.MergeService.executeGePrintSyncTask()|1018
boolean com.dustpan.zeus.core.service.InitShopDateService.executeInitShopTask()|14
boolean com.dustpan.zeus.core.service.MergeService.executeGePrintSyncTask()|937
boolean com.dustpan.zeus.core.service.InitShopDateService.executeInitShopTask()|17
boolean com.dustpan.zeus.core.service.MergeService.executeGePrintSyncTask()|601
boolean com.dustpan.zeus.core.service.InitShopDateService.executeInitShopTask()|52
boolean com.dustpan.zeus.core.service.MergeService.executeGePrintSyncTask()|5081
boolean com.dustpan.zeus.core.service.InitShopDateService.executeInitShopTask()|388
boolean com.dustpan.zeus.core.service.MergeService.executeGePrintSyncTask()|198
boolean com.dustpan.zeus.core.service.InitShopDateService.executeInitShopTask()|11
boolean com.dustpan.zeus.core.service.MergeService.executeGePrintSyncTask()|203
boolean com.dustpan.zeus.core.service.InitShopDateService.executeInitShopTask()|11
boolean com.dustpan.zeus.core.service.MergeService.executeGePrintSyncTask()|241
boolean com.dustpan.zeus.core.service.InitShopDateService.executeInitShopTask()|13
boolean com.dustpan.zeus.core.service.MergeService.executeGePrintSyncTask()|176
boolean com.dustpan.zeus.core.service.InitShopDateService.executeInitShopTask()|12
boolean com.dustpan.zeus.core.service.MergeService.executeGePrintSyncTask()|206
boolean com.dustpan.zeus.core.service.InitShopDateService.executeInitShopTask()|33
boolean com.dustpan.zeus.core.service.MergeService.executeGePrintSyncTask()|242
boolean com.dustpan.zeus.core.service.InitShopDateService.executeInitShopTask()|19

report.txt

linux命令方法:sort -run -k 2 -t '|' report.txt
 原理:sort linux下的排序工具,参数解释:
  -r  降序排列
  -u  去重
  -n  以数字大小排序(默认是首字母排序)
  -t  指定分隔符 这里我们指定'|'为分隔符
  -k  指定分隔后的第几位进行排序 这里我们指定第2位

使用linux sort给一个文件里的内容按规则排序的更多相关文章

  1. linux怎么模糊查找一个文件

    linux如何模糊查找一个文件 在当前目录下搜索指定文件: find . -name test.txt 在当前目录下模糊搜索文件: find . -name '*.txt' 在当前目录下搜索特定属性的 ...

  2. shell统计一个文件里某行出现的次数并排序

    话说有个aaa.txt文件,文件内容如下: aaaabbbbccccddddeeeeffffmmmmooooaaaaccccaaaabbbbddddaaaammmmbbbbaaaaoooo 然后面试题 ...

  3. linux 如何显示一个文件的某几行(中间几行)

    linux 如何显示一个文件的某几行(中间几行) [一]从第3000行开始,显示1000行.即显示3000~3999行 cat filename | tail -n +3000 | head -n 1 ...

  4. 【转载】在Linux下,一个文件也有三种时间,分别是:访问时间、修改时间、状态改动时间

    在windows下,一个文件有:创建时间.修改时间.访问时间.而在Linux下,一个文件也有三种时间,分别是:访问时间.修改时间.状态改动时间. 两者有此不同,在Linux下没有创建时间的概念,也就是 ...

  5. Linux中一个文件10行内容,如何输出5-8内容到屏幕

    题目是这样的,Linux中一个文件10行内容,如何输出5-8内容到屏幕首先我们模拟一下这样的环境: [root@localhost question]# pwd /root/question [roo ...

  6. Windows cmd 将命令(/指令)写到一个文件里,直接运行这个文件。提高工作效率

    Windows cmd 批处理(cmd/bat)文件的简单使用介绍 前言 如果你想我一样,要每天都需要在cmd上,用键盘去敲击相同的命令,时间一长,你就觉得很无聊.有没有什么比较高效的方法,让我们不用 ...

  7. Linux 如何查看一个文件夹下面有多少个文件

    Linux 如何查看一个文件夹下面有多少个文件 $ tree $ find ./ -type f | wc -l $ ls -l | grep "^-" | wc -l refs ...

  8. java中的文件读取和文件写出:如何从一个文件中获取内容以及如何向一个文件中写入内容

    import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.Fi ...

  9. Flex读取txt文件里的内容(二)

    Flex读取txt文件里的内容 自己主动生成的文件 LoadTxt-app.xml: <?xml version="1.0" encoding="utf-8&quo ...

随机推荐

  1. H5 canvas圆形的时钟

    今天用H5中的canvas标签做一个时钟,H5中有很多好用的新增标签,真的很不错. 1.canvas标签介绍 <canvas> 标签定义图形,比如图表和其他图像,你必须使用脚本来绘制图形. ...

  2. 使用openXML 不用插件导出excel

    注释很详细,不做解释了,有疑问可以提问 using System.IO; using System.Text; namespace iLIS.Common { /// <summary> ...

  3. 深入理解Java常用类----String(二)

    上篇介绍了String类的构造器,获取内部属性等方法,最后留下了最常用的局部操作函数没有介绍,本篇将接着上篇内容,从这些最常见的函数的操作说起,看看我们日常经常使用的这些方法的内部是怎么实现的.第一个 ...

  4. 在centos7下安装python3

    环境搭建 准备工具: centos7:http://mirror.bit.edu.cn/centos/7/isos/x86_64/CentOS-7-x86_64-DVD-1611.iso virtus ...

  5. Jmeter 初学(一)

    Jmeter 目前属于比较流行的测试工具,即可做自动化测试也可以做性能测试,而且比较方便. 环境准备: Jmeter 运行环境需要跑在java环境,首先需要安装一下java的环境,由于我目前使用的Jm ...

  6. mac Ubuntu 设置快捷进入目录

    在我们实际工作中,好多时间需要经常性的进入某个目录查看文件等等之类的操作. 好多时候我们都是在终端一级一级的进入目录,相比较Windows的快捷方式有点繁琐. 废话少说,下面就是设置快捷方式的方法: ...

  7. GirdView分页

    给gridview增加以下时间,即可 设置pageindex 重新绑定数据 protected void GvMenu_PageIndexChanging(object sender, GridVie ...

  8. SQLServer树形数据结构的数据进行数据统计

    前言 前几天朋友问我,关于SQLServer数据库中对树形结构的表数据统计问题,需求大致如下: 分类表(递归数据),A的子分类是B,B的子分类是C--分类关系不间断,A为第一层,B为第二层,C为第三层 ...

  9. java虚拟机学习-JVM调优总结-典型配置举例(10)

    以下配置主要针对分代垃圾回收算法而言. 堆大小设置 年轻代的设置很关键 JVM中最大堆大小有三方面限制:相关操作系统的数据模型(32-bt还是64-bit)限制:系统的可用虚拟内存限制:系统的可用物理 ...

  10. Lambda应用场景和使用实例

    Java 8已经推出一段时间了,Lambda是其中最火的主题,不仅仅是因为语法的改变,更重要的是带来了函数式编程的思想.这篇文章主要聊聊Lambda的应用场景及其相关使用示例. Java为何需要Lam ...