File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -279,6 +279,23 @@ $ grep -R 'hello' . # 递归查找当前目录下内容包含 hello 的文件
279279
280280 grep 事实上是非常强大的查找工具,[第九章](../Ch09/index.md)将在介绍正则表达式语法之后进一步介绍 grep。
281281
282+ !!! tip "ripgrep"
283+
284+ 除了 grep 以外,还有一个更快更强大的工具 [ripgrep](https://github.com/BurntSushi/ripgrep)。其会默认递归查找当前目录下的文件。安装 `ripgrep` 包后使用 `rg` 命令,即可作为 `grep -R` 的替代:
285+
286+ ```console
287+ $ # 在 /etc/ 下搜索包含 localhost 的文件
288+ $ rg localhost /etc/
289+ /etc/hosts
290+ 1:127.0.0.1 localhost
291+ 2:::1 localhost
292+
293+ /etc/security/pam_env.conf
294+ 52:# to "localhost" rather than not being set at all
295+ 53:#REMOTEHOST DEFAULT=localhost OVERRIDE=@{PAM_RHOST}
296+ 64:#NNTPSERVER DEFAULT=localhost
297+ ```
298+
282299### 文本替换:sed {#sed}
283300
284301` sed ` 命令可以替换文本中的字符串:
You can’t perform that action at this time.
0 commit comments