码迷,mamicode.com
首页 >  
搜索关键字:awk awk笔记 awk    ( 4639个结果
linux操作
awk1、打印文件的第一列(域) : awk '{print $1}' filename2、打印文件的前两列(域) : awk '{print $1,$2}' filename3、打印完第一列,然后打印第二列 : awk '{print $1 $2}' filename4、打印文本文件的总行数...
分类:系统相关   时间:2014-10-14 20:19:59    阅读次数:201
系统初始化脚本
####closeserviceTimeServerMaster="192.168.6.13"SSHPort="58522"echored(){echo-ne"\033[31m"$1"\033[0m\n"}echogreen(){echo-ne"\033[32m"$1"\033[0m\n"}IPN=`ifconfig|grep192.168|awk‘{print$2}‘|cut-d:-f2|awk-F.‘{print$3"-"$4}‘`HOSTNAME="HK$IPN"hostname$HOSTNAMEsed..
分类:其他好文   时间:2014-10-13 02:47:49    阅读次数:404
PHP脚本监控程序
#!/bin/sh # Find ip IP=`/sbin/ifconfig eth1 | grep 'inet addr' | awk '{ print substr($2, index($2, ":")+1)}'` #monitor procname scriptname monitor() { procname=$1 scriptname=$2 # Find proc by p...
分类:Web程序   时间:2014-10-12 10:46:07    阅读次数:267
进程监控脚本
#!/bin/sh my_ip=`/sbin/ifconfig eth1 | grep 'inet addr' | awk '{print substr($2, index($2, ":")+1)}'` recv="" msg="not_existing, restart ..." MONITOR_LOG="monitor.log" #monitor procname scriptname...
分类:系统相关   时间:2014-10-11 23:25:07    阅读次数:329
(linux) 常用命令 干货
内容提要1. 第一难度, 重要 梯队 (grep, awk, sed, find, )2. 第二常用, 重要 梯队 (ps, ls, date, fuser, netstat, kill)3. 第三 特殊用途 梯队 (压缩打包, 背景运行, 工作例程, 性能监控, 安装包)4. 正则表达式一. 难度...
分类:系统相关   时间:2014-10-11 17:22:45    阅读次数:226
Linux Unix shell 编程指南学习笔记(第二部分)
第七章  正则表达式介绍...
分类:系统相关   时间:2014-10-10 23:58:26    阅读次数:386
找出系统中所有以user0开头并且是可以登录和没有密码的用户,并生成文本文件保存。
为了实验,创建5个用户user01user02user03user04user05,其中user02的shell是/sbin/nologin,并且没有密码,user03没有密码,user05的shell是/sbin/nologingrepuser0/etc/passwd|awk-F\:‘{print$1,$7}‘>>boss1.txtgrepuser0/etc/shadow|awk-F\:‘{print$2}‘>>boss2...
分类:其他好文   时间:2014-10-10 15:37:14    阅读次数:195
Linux防止ssh暴力扫描IP
首先修改ssh端口。创建脚本pb_ssh.sh#!/bin/bash#crontab每隔1分钟执行一次#*/1****/root/pb_ssh.sh#获取前1分钟内的secure记录,统计ssh认证失败的IP和其失败次数SCANNER=`grep"$(date-d-1min|awk‘{printsubstr($0,10,7)}‘)"/var/log/secure|awk‘/Failed/{print$(NF-3)}‘|awk-..
分类:系统相关   时间:2014-10-09 20:47:28    阅读次数:187
浅谈sql的字符分割
对于oracle;在字符串处理时;经常会遇到字符串分割的问题;可惜SQL中没有split函数;这个倒是挺困扰我们写sql的。对此;我来说说这字符串分割。 例如对字段str中一条数据是'120-mm-265';我要取到其中的mm。若对其它语言之间;例如awk。split("120-mm-265",a....
分类:数据库   时间:2014-10-09 19:54:37    阅读次数:256
提取最近一小时的访问次数
times=`tail-1/Data/logs/nginx/access.log|awk‘{print$4}‘`m_time=`echo${times}|awk-F:‘{print$2}‘`foriin010203040506070809;doif[$i-eq${m_time}];thenm_time=`echo${m_time#0}`fidoneif[${m_time}="00"];thens_time="23"elselet"s_time=${m_time}-1"num=`exprlength${s_ti..
分类:其他好文   时间:2014-10-09 19:08:58    阅读次数:221
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!