tldr/pages.zh/windows/findstr.md

33 lines
787 B
Markdown
Raw Normal View History

2019-03-11 02:12:28 +00:00
# findstr
> 在一个或多个文件中查找指定的文本。
> 更多信息:<https://learn.microsoft.com/windows-server/administration/windows-commands/findstr>.
2019-03-11 02:12:28 +00:00
- 在所有文件中查找以空格分隔的字符串:
2019-03-11 02:12:28 +00:00
2019-10-20 03:34:33 +01:00
`findstr "{{查询语句 查询语句 ..}}" *`
2019-03-11 02:12:28 +00:00
- 以递归方式在所有文件中查找以空格分隔的字符串:
2019-03-11 02:12:28 +00:00
2019-10-20 03:34:33 +01:00
`findstr /s "{{查询语句 查询语句 ..}}" *`
2019-03-11 02:12:28 +00:00
- 查找时不区分大小写:
2019-03-11 02:12:28 +00:00
`findstr /i "{{查询语句}}" *"`
- 使用正则表达式搜索:
2019-03-11 02:12:28 +00:00
`findstr /r "{{正则表达式}}" *`
- 在所有文本文件中查找文字字符串(包含空格):
2019-03-11 02:12:28 +00:00
`findstr /c:"{{查询语句}}" *.txt`
- 显示匹配的行的行数:
2019-03-11 02:12:28 +00:00
`findstr /n "{{查询语句}}" *`
- 只显示匹配的文件名:
2019-03-11 02:12:28 +00:00
`findstr /m "{{查询语句}}" *`