命令提示符中的FINDSTR [英] FINDSTR in Command Prompt
问题描述
我尝试使用 cmd.exe中的
。我的命令不产生任何结果,而 FINDSTR
commanand从包含某个字符串的输入文件中生成包含所有行的文件 FIND
命令(也在下面)显示有182,688行包含我正在寻找的字符...
I am trying to generate a file with all of the rows from an input file containing a certain string using the FINDSTR
commanand in cmd.exe
. My command below does not produce any results, whereas the FIND
command (also below) shows that there are 182,688 rows containing the string I'm looking for...
FIND命令:
FIND /c "searchstring" c:\Users\karl\Desktop\Report.csv
提供以下:
---------- C:\USERS\KARL\DESKTOP\REPORT.CSV: 182688
FINDSTR命令:
findstr /i /c:"searchstring" c:\Users\karl\Desktop\Report.csv > results.out
给我一个名为results.out的空白文件。
gives me a blank file called results.out.
我失踪了什么?
推荐答案
FINDSTR有许多未记录的功能 。请参见 Windows FINDSTR命令的未记录的功能和限制。
FINDSTR has many undocumented "features" that could be tripping you up. See What are the undocumented features and limitations of the Windows FINDSTR command?
您没有告诉我们您的搜索字符串是什么,所以我不能确定。但您的问题可能与以下一个或多个相关:
You have not told us what your search string is, so I can't be sure. But your problem is probably related to one or more of the following:
- 转义
c $ c>和
\
在文字搜索字符串中 - 许多扩展ASCII字符在命令行搜索字符串
- FINDSTR无法搜索unicode文件。我被告知FIND可以搜索unicode文件。
- Special rules for escaping
"
and\
within literal search strings - Many extended ASCII characters do not find themselves when used in command line search strings.
- FINDSTR cannot search unicode files. I am told that FIND can search unicode files.
这篇关于命令提示符中的FINDSTR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!