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
#!/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
内容提要1. 第一难度, 重要 梯队 (grep, awk, sed, find, )2. 第二常用, 重要 梯队 (ps, ls, date, fuser, netstat, kill)3. 第三 特殊用途 梯队 (压缩打包, 背景运行, 工作例程, 性能监控, 安装包)4. 正则表达式一. 难度...
分类:
系统相关 时间:
2014-10-11 17:22:45
阅读次数:
226
为了实验,创建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
首先修改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
对于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