In this lesson, we’ll use grep to find text patterns. We’ll also go over some of the flags that grep has that can be combined together to make it more powerful and easier to read.

grep --color -n -C  "npm.config.get" lib/**/*.js

# --color: highlight
# -n: show line number
# -C : show lines for each context
# search for content "npm.config.get"
# in 'lib' folder for every matching js files

Can also using '-e' for regex partten.

Using `man grep` for help

[Bash] Search for Text with `grep`的更多相关文章

  1. 【Linux】【Shell】【text】grep

    grep: Global search REgular expression and Print out the line. 作用:文本搜索工具,根据用户指定的"模式(过滤条件)" ...

  2. [Linux] Search the contents of files using grep

    Learn the basic syntax for using grep to search the contents of a single file or files. It's like CM ...

  3. Linux Bash文本操作之grep篇

    Linux grep命令用于查找文件里符合条件的字符串.是文本检索中常用的工具之一. grep  指令在文件中查找能够匹配指定模式字符串的行.如果没有指定文件名,或者文件名为  -  ,则从标准输入设 ...

  4. MongoDB的全文检索(Text Search)功能

    自己的项目中用到了mongodb,需要做一个搜索功能,刚开始不知道怎么搞,查了mongodb有个全文检索功能. 全文检索分为两步 第一,建立索引 db.stores.createIndex( { na ...

  5. linux下编译make文件报错“/bin/bash^M: 坏的解释器,使用grep快速定位代码位置

    一.linux下编译make文件报错“/bin/bash^M: 坏的解释器 参考文章:http://blog.csdn.net/liuqiyao_01/article/details/41542101 ...

  6. Linux的正则表达式grep,egrep

    一.概念 正则表达式是对字符串操作的一种逻辑公式,用事先定义好的一组特殊字符,组成一个"规则字符集合",根据用户指定的文本模式对目标文件进行逐行搜索匹配,显示能被模式匹配到的结果. ...

  7. grep精确匹配搜索某个单词的用法 (附: grep高效用法小结))

    grep(global search regular expression(RE) and print out the line,全面搜索正则表达式并把行打印出来)是一种强大的文本搜索工具,它能使用正 ...

  8. powershell与linux bash对比

    转自Github/Powershell Bash PowerShell Description ls dir, Get-ChildItem List files and folders tree di ...

  9. shell脚本执行时报"bad interpreter: Text file busy"的解决方法

    在执行一个shell脚本时,遇到了“-bash: ./killSession.sh: /bin/bash: bad interpreter: Text file busy”错误提示,如下所示: [or ...

随机推荐

  1. delphi中使用自定义资源的方法

    如果要在delphi中使用自定义资源文件*.res文件,比如一个光标,此时可以采用下列步骤: 1,创建包含相应的资源文件,这里是创建一个包含自定义光标的res文件. 2,在主窗体的pas文件中加入编译 ...

  2. hibernate 入门配置

    转自: https://segmentfault.com/a/1190000013568216

  3. mysql查询速度慢的原因[整理版]

    在以前的博客中陆续记录了有关查询效率方面的文章.今天在整理一下,写上自己的一些心得记录如下:常见查询慢的原因常见的话会有如下几种:1.没有索引或没有用到索引.PS:索引用来快速地寻找那些具有特定值的记 ...

  4. 使用SimpleDateFormat 将毫秒转换成时分秒 格式:HH:mm:ss

    public static String dateFormatFromMilliSecond(long seconds) {        //初始化format格式    SimpleDateFor ...

  5. Centos 7 编译nginx 1.14.0

    步骤一:下载nginx安装包 wget https://nginx.org/download/nginx-1.14.0.tar.gz 步骤二:安装nginx依赖包 yum install -y gcc ...

  6. 【struts2】学习笔记

    常见问题及注意事项: 1.下载struts2时,要看清所下载的版本,不同版本web.xml配置路径不同! 2. 导入jar包时,导入的包要完全准确,缺少或过多的会导致缺失或冲突! 3. Registe ...

  7. 杭电 1213 How Many Tables (并查集求团体数)

    Description Today is Ignatius' birthday. He invites a lot of friends. Now it's dinner time. Ignatius ...

  8. 【HIHOCODER 1320】压缩字符串(区间DP)

    描述 小Hi希望压缩一个只包含大写字母'A'-'Z'的字符串.他使用的方法是:如果某个子串 S 连续出现了 X 次,就用'X(S)'来表示.例如AAAAAAAAAABABABCCD可以用10(A)2( ...

  9. POJ 2553 The Bottom of a Graph(强连通分量的出度)

    题意: 求出图中所有汇点 定义:点v是汇点须满足 --- 对图中任意点u,若v可以到达u则必有u到v的路径:若v不可以到达u,则u到v的路径可有可无. 模板:http://www.cnblogs.co ...

  10. Github 多账号配置

    1. 不同账户,生成不同密钥ssh-keygen -t rsa -f github1 -C "xxx@163.com"ssh-keygen -t rsa -f github2 -C ...