zoukankan      html  css  js  c++  java
  • grep 的学习 正则

    grep 命令:

    grep  "name"   /path/file_name    从file_name文件中中查找 name 字符

    grep  -c    "name"   /path/file_name  统计查找到name 的总共的行数

    grep  -n    "name"   /path/file_name  统计查找到name 的所在的行数

    grep  -i    "name"   /path/file_name  查找name 不区分大小写

    grep  -v    "name"   /path/file_name  取反,找除name 以外的,所有字符

    grep  -A#     "name"   /path/file_name  查找name, 并且显示 name后面的,  #多少行

         -B# "name"   /path/file_name  查找name, 并且显示 name前面的,  #多少行

         -C # "name"   /path/file_name  查找name, 并且显示 name前后的,  #多少行

    除了点号 . 还有? 问号 , ? 问号 表示前面字符的0次或 1 次。(grep -E  或用 egrep )  

    由点 . 号可以推出 : *  星号就表示,任意个 任意字符,* 星号表示0次或多次 ,而 + 加号又和 * 星号等价,但 + 号表示 1次或多次。

  • 相关阅读:
    Java-对象数组排序
    aoj 0118 Property Distribution
    poj 3009 Curling 2.0
    poj 1979 Red and Black
    AtCoder Regular Contest E
    AtCoder Beginner Contest 102
    AtCoder Beginner Contest 104
    SoundHound Inc. Programming Contest 2018
    poj 3233 Matrix Power Series
    poj 3734 Blocks
  • 原文地址:https://www.cnblogs.com/nfyx/p/8948928.html
Copyright © 2011-2022 走看看