sortsort 命令对 File 参数指定的文件中的行排序,并将结果写到标准输出。如果 File 参数指定多个文件,那么 sort 命令将这些文件连接起来,并当作一个文件进行排序。sort语法[root@www ~]# sort [-fbMnrtuk] [file or stdin]选项与参数:-...
分类:
系统相关 时间:
2015-06-24 12:45:28
阅读次数:
209
words.txt中的内容如下:the day is sunny the the the sunny is is统计每个单词出现的次数,并降序输出。Unix Pipes脚本如下:cat words.txt | tr -s ' ' '\n' | sort | uniq -c | s...
分类:
系统相关 时间:
2015-06-17 23:23:21
阅读次数:
151
测试文件[root@bogon ~]# cat >testjasonjasonjasonfffff按 Ctr + D保存1、sort -u[root@bogon ~]# sort -u testfffffjason2、uniq[root@bogon ~]# uniq testjasonfffffja...
分类:
系统相关 时间:
2015-06-10 15:31:21
阅读次数:
212
转自:http://blog.slogra.com/post-385.html今天服务网站明显过慢查年了一下服务器联接数,纠结于怎么搞定TIME_WAIT# netstat -an|awk '/tcp/ {print $6}'|sort|uniq -c 68 CLOSE_WAIT 2 CLOSIN....
分类:
系统相关 时间:
2015-06-09 08:29:40
阅读次数:
180
cat access.log|awk '{print $0}'|sort|uniq -c|sort -nr|head -n 10
分类:
Web程序 时间:
2015-06-05 19:30:59
阅读次数:
108
Clone an undirected graph. Each node in the graph contains alabeland a list of itsneighbors.OJ's undirected graph serialization:Nodes are labeled uniq...
分类:
其他好文 时间:
2015-06-05 12:15:11
阅读次数:
112
-c, --count 在每行前加上表示相应行目出现次数的前缀编号-d, --repeated 只输出重复的行-D, --all-repeated[=delimit-method 显示所有重复的行delimit-method={none(default),prepend,separate}以空行为界...
分类:
其他好文 时间:
2015-06-02 21:28:03
阅读次数:
123
查看所有80端口的连接数netstat-nat|grep-i“80”|wc-l对连接的IP按连接数量进行排序netstat-ntu|awk‘{print$5}’|cut-d:-f1|sort|uniq-c|sort-n查看TCP连接状态netstat-nat|awk‘{print$6}’|sort|uniq-c|sort-rnnetstat-n|awk‘/^tcp/{++S[$NF]};END{for(ainS)printa,..
分类:
其他好文 时间:
2015-06-02 18:13:15
阅读次数:
163
#!/bin/bash#fixbyleiporeat2014-12-18ddos-autoprotection.shtouch/root/back_bad_ip.txttime=`date+"%Y-%m-%d%H:%M:%S"`ar=`wc-l/root/back_bad_ip.txt|awk‘{print$1}‘`sleep1netstat-an|grep80|grep-v"STREAM"|awk‘{print$5}‘|sort|awk-F:‘{print$1}‘|uniq-c|awk‘$1>200{..
分类:
系统相关 时间:
2015-06-01 14:55:51
阅读次数:
285
1.diff --查看两个文件间不同地方,对比两个文件。#diff/etc/passwd/tmp/passwd2.uniq --去除重复行-c 统计重复的行数有几行-i 忽略大小写-d 只显示重复的行#uniq/tmp/passwduniq-d/tmp/passwd|head-2&>aa.txt3.sort --排序7-r 反向-n 以数字来排序-u 合并同类-t ..
分类:
系统相关 时间:
2015-05-31 06:54:06
阅读次数:
248