![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Shell
文章平均质量分 63
余建新-18588497759
这个作者很懒,什么都没留下…
展开
-
一个简单的Shell 解答网友问题
解决问题:Shell实现每5秒钟打印一次当前时间,打印10次原创 2014-06-16 18:38:59 · 853 阅读 · 0 评论 -
集群批量操作
vi operate.sh#!/bin/bashcmd=$1#cmd="jps -l"#cmd="rm -rf /usr/local/fqlhadoop/logs/hbase/*"#cmd="ll /usr/local/fqlhadoop/hbase-1.1.2/logs/*"#cmd="hostname"#cmd="date"#cmd="service gmond rest原创 2016-10-07 21:46:23 · 709 阅读 · 0 评论 -
Shell获取毫秒时间
#明天凌晨tomorrow=`date -d next-day +%Y-%m-%d`timeStamp=`date -d "$tomorrow 00:00:00" +%s`currentTimeStamp=$(($timeStamp*1000+`date "+%N"`/1000000)) #将current转换为时间戳,精确到毫秒echo $currentTimeStamp#当前时间原创 2016-10-13 13:30:12 · 20334 阅读 · 0 评论 -
Shell-记录-1
原创 2016-03-22 16:40:14 · 355 阅读 · 0 评论 -
重复ip(单词计数)不同语言实现对比
Shellawk '{a[$1]++} END{for(i in a)print i,a[i]}' ip.txtPython Javapackage p;import java.io.BufferedReader;import java.io.FileReader;import java.util.HashMap;import java.util原创 2015-10-29 12:02:49 · 684 阅读 · 0 评论 -
Shell统计
1、统计独立ip个数,并排序(类似COUNT(DISTINCT) ORDER BY)awk '{print $1}' ./log.txt | sort | uniq | wc -l2、查询top10(类似ORDER BY LIMIT)awk '{print $1}' ./log.txt | sort | uniq -c | sort -nr | head -103、过滤查找(类似W原创 2015-10-29 10:17:05 · 556 阅读 · 0 评论 -
Shell中uniq与sort -u两种去重的对比
结论:uniq所谓的重复是连续出现的相同记录。 http://blog.sina.com.cn/s/blog_58742eb901018za5.html原创 2015-10-29 10:44:50 · 1944 阅读 · 0 评论 -
Shell统计访问ip UV、PV
数据[root@192 test]# cat ip.txt 192.168.0.1 zhangxc192.168.0.1 zhangxc1192.168.0.1 zhangxc3192.168.0.2 zhangc192.168.0.2 zhangc1192.168.0.3 zhangc192.168.0.3 zhangc192.168.0.3 zhangxc原创 2015-10-29 11:22:11 · 1644 阅读 · 0 评论 -
常用 shell 记录
1、test1.sh 内容#!/bin/shecho "$*"echo "$@"echo "$#"./test1.sh 1 2 3 运行结果:1 2 31 2 33总结:$* 表示所有这些参数都被双引号引住。若一个脚本接收两个参数,$*等于$1$2$@ 表示所有这些参数都分别被双引号引住,若一个脚本接收到两个参数,$@等价于$1$2$# 表示提供给脚本的原创 2015-03-18 19:07:18 · 546 阅读 · 0 评论 -
Shell-记录-2
#!/bin/bash# Rsync's HBase config files across all region servers. Must run on master.for srv in $(cat /opt/hbase/conf/regionservers);do echo "Sending command to $srv..."; rsync -vaz --delete原创 2016-03-22 16:45:50 · 453 阅读 · 0 评论