markdown Grep使用

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown Grep使用相关的知识,希望对你有一定的参考价值。

```bash
grep -Hrn 'search term' path/to/files
```
--------------------

* **-H** causes the filename to be printed (implied when multiple files are searched)
* **-r** does a recursive search
* **-n** causes the line number to be printed
* **path/to/files** can be . to search in the current directory

Further options that I find very useful:

* **-I** ignore binary files (complement: -a treat all files as text)
* **-F** treat search term as a literal, not a regular expression
* **-i** do a case-insensitive search
* **--color=always** to force colors even when piping through less. To make less support colors, you need to use the -r option:

```bash
grep -Hrn search . | less -r
```
* **--exclude-dir=dir** useful for excluding directories like .svn and .git.

--------------------

以上是关于markdown Grep使用的主要内容,如果未能解决你的问题,请参考以下文章

markdown linux,命令,grep

markdown #bash #regex #cheatsheet #grep

markdown [正则表达式和Grep工具] #tutorial

markdown 外部的grepで指定したパスを検索対象から除く

小猿圈之Linux使用grep筛选多个条件及grep常用过滤命令

使用grep命令怎么过滤多个条件