zoukankan      html  css  js  c++  java
  • [linux专题](1)grep

    Linux指令查询网站:http://man.linuxde.net/

    -1- grep 指令
    grep: global search regular expression(RE) and print out the line
    全面搜索正则表达式并把行打印出来。
    pattern:grep [option] [reg] [file]|[input](0-n) [-A|B|C n]
    para:not all|some usually used
    -e: 使用正则搜索 => 【正则表达式】 ^ 开头 $结尾 ^$空行
    -i: 不区分大小写
    -v: 查找不包含指定内容的行 grep -r log . 在当前目录的所有文件中找leo
    -w: 按单词搜索
    -c: 统计匹配到的次数
    -n: 显示行号
    -r: 逐层遍历目录查找

    -A: 显示匹配行及前面多少行, 如: -A3, 则表示显示匹配行及前3行
    -B: 显示匹配行及后面多少行, 如: -B3, 则表示显示匹配行及后3行
    -C: 显示匹配行前后多少行, 如: -C3, 则表示显示批量行前后3行
    --color: 匹配到的内容高亮显示
    --include: 指定匹配的文件类型
    --exclude: 过滤不需要匹配的文件类型

    attention:It can't be interrupted when it runs.

    相似指令:

    egrep fgrep bzgrep grep

    约等于grep -e

    采用extended regular expression

       

    grep -e采用basic regular expression

     

    查找Fixed String

    用法等于grep -F

    【据说出错机制不同,但在linux上输入,查不到到时候没有显示,与grep -F一样】

     

    grep -F F=Fixed String

       

    用正则表达式搜索“.bz2”压缩包中的文件。

    bzgrep -a(必须要带)'keyword|pattern' filename

    和grep一样。这个命令使用频率较低。

     
  • 相关阅读:
    About “condition variables”
    路由表的读法(zz)
    C++字符串之一(字符表示)
    Audio Codec Summary
    关于telnet
    C++ 之 new
    (转)让ubuntu9.10开机自动挂载NTFS分区
    WorkSpace And Static Library In GarbageXcode4
    mac os x 10.7下配置svn服务器
    ubuntu下设置双显示器扩展桌面
  • 原文地址:https://www.cnblogs.com/Years4Nancy/p/8341810.html
Copyright © 2011-2022 走看看