Tag: grep

  • grep出现报错binary file matches
  • 利用grep和prce2grep的正则方法来处理截取html源代码文件内容
  • grep出多个条件的行

    grep出多个条件的行

    例子: 找出ok:开头,并且包含$1的行。 再次grep包含$1的行,包括其前一行,打印出来,带颜色 egrep -E “^ok:|$1” *.psef|grep -B 1 $1 –color 放到一个sh文件里,比如寻找xxx,执行: ./youscript xxx

  • grep与正则表达式基础

    grep与正则表达式基础

    1 命令:grep 2 格式:grep [option] “pattern” filename 3 选项: 4 -v:反向选择 5 -i:忽略大小写 6 -n:显示行号 7 -c:统计行数 8 -o:仅显示匹配到的字符串 9 -w:匹配整个单词 10 -q:不输出任何信息 11 -A 2:after 显示后2行 12 -B 3:before 显示前3行 13 -C 3:context 前后各3行 14 -e:实现多个选项间的逻辑关系 15 grep -e root -e mail /etc/passwd 16 -E:相当于egrep,用于使用拓展的正则表达式 17 -F:相当于fgrep,不支持正则表达式 复制代码 正则表达式(Regular expression) 什么是正则表达式 Regular expression(正则表达式)是由一类特殊字符及文本字符编写的模式,其中有些字符(元字符)不代表字符的字面意义,而表示控制或通配功能。 那些程序支持正则表达式…

  • linux下用netstat和lsof发现恶意进程和链接并匹配grep出公网外网ip地址

    linux下用netstat和lsof发现恶意进程和链接并匹配grep出公网外网ip地址

    The malicious files are being identified by the two powerful commands given below. 1)Netstat: -The command # netstat –an is used to show the all the current network connections currently in use along with the port numbers. Make sure to execute the command in root privilege. 2)Lsof: lsof is one of the best useful utility…