通配符与正则表达式的区别
通配符是bash原生支持的语法+表格
语系设置 : export LANG=C
grep alias 设置 : grep --color=auto
正则表达式是处理字符串的一种表示方式, 正则表达式需要支持的工具支持才可以
通配符:
正则:
拓展正则:
grep 的一些高级参数...
分类:
系统相关 时间:
2014-11-20 17:08:38
阅读次数:
225
shell字符串的截取的问题:一、Linux shell 截取字符变量的前8位,有方法如下: 1.expr substr “$a” 1 8 2.echo $a|awk ‘{print substr(,1,8)}’ 3.echo $a|cut -c1-8 4.expr $a : ‘\(.\\)...
分类:
系统相关 时间:
2014-11-19 21:55:33
阅读次数:
314
1.awk中引用外部变量,有三种方式awk 'pattern{action}' file1)awk '{print a,b}' a=111 b=222 file,此时BEGIN模块无法用该变量2) awk -v a=111 b=222 '{print a,b}' file3) a=111;b="网页...
分类:
其他好文 时间:
2014-11-19 21:49:29
阅读次数:
126
在做shell批处理程序时候,经常会涉及到字符串相关操作。有很多命令语句,如:awk,sed都可以做字符串各种操作。 其实shell内置一系列操作符号,可以达到类似效果,大家知道,使用内部操作符会省略启动外部程序等时间,因此速度会非常的快。一、判断读取字符串值表达式含义${var}变量var的值, ...
分类:
系统相关 时间:
2014-11-19 07:11:27
阅读次数:
260
我书里的那个命令是针对ROW格式的,下面增加一个MIXED格式的。mysqlbinlog--no-defaults--base64-output=decode-rows-vvmysql-bin.004177|
awk‘/UPDATE|INSERT|DELETE/{gsub("###","");gsub("INSERT.*INTO","INSERT");
gsub("DELETE.*FROM","DELETE");
count[$1""$2]++}END{for..
分类:
其他好文 时间:
2014-11-19 02:20:16
阅读次数:
216
#!/bin/shname=`ls ./`for i in $name;do aaa=`find $i -type f |xargs ls -ltr|tail -1|awk -F" " '{print $6$7" "$8}'` count=`find $i -type f -exe...
分类:
其他好文 时间:
2014-11-17 10:32:59
阅读次数:
131
1. awk最基本的功能是在输入文件中按行匹配指定的字符串格式,如果匹配则将当前行复制到缓冲区进行进一步处理,但并不改变输入文件本身。awk匹配每一行(称为Record)后,使用默认或指定的分割符自动将其分割为若干段(称为Field),每一段可使用$number进行引用和访问。其中段号0对应整个Re...
分类:
其他好文 时间:
2014-11-16 18:42:27
阅读次数:
197
#!/bin/bashfunctionusage{echo"use./test_net.shethXtime"echo"$1isyounetworkinterface"echo"$2isthelasttime!"echo"forexample:./test_net.sheth02"exit100}if[$#-lt2-o$#-gt2];thenusagefieth=$1time=$2old_inbw=`cat/proc/net/dev|grep$eth|awk-F‘[:]+‘‘{print$3}‘`old_ou..
分类:
系统相关 时间:
2014-11-16 02:02:18
阅读次数:
277
#!/bin/bash#analysisthemysqlslowlog#Writenbylandline#IPadd=`grep`hostname`/etc/hosts|awk-F‘‘‘END{print$1}‘`IPadd=`/sbin/ifconfigeth0|grepBcast|awk-F:‘{print$2}‘|awk‘{print$1}‘`serverday=`date-d‘-1day‘+%Y-%m-%d`nowday=`date"+%y%m%d"`yestoday=`date-d‘-1day‘+%..
分类:
数据库 时间:
2014-11-15 06:44:39
阅读次数:
290