任务: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. java之反射

    初学反射,也是第二次写博客了把,就简单记录一下. Reflection(反射)是被视为动态语言的关键,反射机制允许程序在执行期借助于Reflection API取得任何类的内部信息,并能直接操作任意对 ...

  2. [笔记]我的Linux入门之路 - 03.Java环境搭建

    其实ubuntu是自带一个叫openJDK的东西的,是谷歌看Oracle不爽而搞的.不过呢...总感觉不太习惯,况且我既然都来Linux了,总是想折腾一把的. 首先先检查下有没有安装java.终端输入 ...

  3. maven私服nexus搭建(windows)

    1.下载nexus 地址:https://www.sonatype.com/download-oss-sonatype 下载相应版本的zip包. 2.安装nexus 下载完成后,解压到本地任意目录. ...

  4. 【JAVAWEB学习笔记】17_jsp

    动态页面技术(JSP/EL/JSTL) 学习目标 案例:完成商品的列表的展示 一.JSP技术 1.jsp脚本和注释 jsp脚本: 1)<%java代码%> ----- 内部的java代码翻 ...

  5. 如何升级php版本---从php5.5.12 升级php7.1.5 wamp实践

    1.从官网下载一个php7.1.5 2.将刚下载的压缩包解压缩,修改命名为php7.1.5,即php+版本号. 3.将这个文件夹放在wamp/bin/php 目录下. 4.将原来版本的php5.5.1 ...

  6. Day5模块-os和sys模块

    os模块:操作系统调用的接口 ------------------------------------------------------------------------------------- ...

  7. Linux 安装USB摄像头

    sudo apt-get update sudo apt-get install fswebcam sudo apt-get install mplayer sudo apt-get install ...

  8. 软件需求规格说明书(spec)

    1.spec 的目标是什么,spec 的目标不包括什么? 我们的目标是对用户发布的各种需求(需要伙伴的需求)进行处理,使别的用户可以看到信息,并且成功找到合适的伙伴一起! 不包括对用户之间的联系. 2 ...

  9. 测试工具——JMeter

    本学期新学的课程,软件测试,上机的实验用到了C++Test,QTP,还有JMeter.今天针对JMeter做一次总结,方便以后用到,知道步骤会更加方便. 首先,对Jmeter进行一个大致的了解,包括对 ...

  10. coreCLR系列随笔 之ClrJit项目之alloc.cpp文件分析(1)

    首先声明,自己对CLR了解得不多,只是个人爱好,可能有错误,请指出,文件源码如下(可能不是最新的) // // Copyright (c) Microsoft. All rights reserved ...