#文件搜索 #字符串搜索 #grep #不区分大小写 #shell #文件行 #区分大小写

bin+lib my_mini_grep

一个旨在模仿 grep 命令行为的迷你应用程序

1 个不稳定版本

0.1.0 2024 年 7 月 29 日

#1020文本处理

Download history 62/week @ 2024-07-23 65/week @ 2024-07-30

每月下载 127 次

MIT/Apache

6KB
91

grep 模拟命令

概述

本项目旨在模仿 grep 命令的行为。它在文件中搜索特定字符串,并返回包含该字符串的所有行。

功能

•	Case-sensitive search by default.
•	Case-insensitive search available through an environment variable.

用法

命令行参数

程序需要两个命令行参数

1.	Search String: The string to search for within the file.
2.	File Path: The path to the file where the search will be performed.

示例

cargo run -- "搜索字符串" file.txt

要执行不区分大小写的搜索,请将 IGNORE_CASE 环境变量设置为 1。这将使该终端会话中的搜索不区分大小写。

示例

IGNORE_CASE=1 cargo run -- "搜索字符串" file.txt

无运行时依赖