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. resnet.caffemodel

    http://blog.csdn.net/baidu_24281959/article/details/53203757

  2. QT+lambda 表达式

    #include "mainwidget.h" #include <QPushButton> #include <QDebug> MainWidget::M ...

  3. 关于mysql服务突然运行不了的问题-“本地计算机上的mysql服务启动后停止,某些...”

    1.将mysql数据库的安装目录bin文件路径添加到环境的path中,为了让cmd可以直接输入下面的相关命令,不然cd到mysql的bin下也可以 2.cmd输入mysqld --initialize ...

  4. cenos6.5作为网关

    入口服务器(网关服务器)关闭selinuxsetenforce 0vim /etc/selinux/config将SELINUX=enforcing改为SELINUX=disabled 修改防火墙ip ...

  5. qt c++对象头文件如何相互包含

    今天在写qt时,遇到了两个类相互包含的问题,类A要用到类B,类B要用到类A. 类A:a.h #ifndef A_H #define A_H #include <b.h> class A { ...

  6. 第一章:systemverilog简介

    1.为何要学systemverilog ..... 2.systemverilog起源 ..... 3.systemverilog标准历程 systemverilog3.0 for 综合 system ...

  7. log4j 、logback 以及slf4j三者之间的关系

    在项目的开发中由于对于log4j.logback以及slf4j之间的关系和相关的知识不能清晰掌握,在业余时间进行记录. 1.三者之间的关系 1) 简答的讲就是slf4j是一系列的日志接口,而log4j ...

  8. Django框架基础知识13-auth系统

    我们昨天登录admin时创建的用户信息是存放在哪里了呢? auth系统的数据表: 从表的名称我们就能看出, auth_user,auth_group,auth_permission分别存放了用户,用户 ...

  9. 【HIHOCODER 1049】 后序遍历

    描述 在参与过了美食节之后,小Hi和小Ho在别的地方又玩耍了一阵子,在这个过程中,小Ho得到了一个非常有意思的玩具--一棵由小球和木棍连接起来的二叉树! 小Ho对这棵二叉树爱不释手,于是给它的每一个节 ...

  10. Jedis 工具类

    package com.pig4cloud.pigx.admin.utils; import redis.clients.jedis.*; import java.util.ArrayList; im ...