我有一个批处理脚本,仅将具有特定字符串的行复制到另一个文件。有时队伍会更长。我正在使用
FindStr /I“字符串”file1>文件2
来执行此操作。但在生成的文件中,它将行截断为 1024 个字符。 dos编程是否有任何限制,文本文件行只能这么长?如果存在这样的限制,那么我们可以设置一些东西来覆盖这种行为。
干杯,PK
I am having a batch script to copy only the lines with a specific string to another file. The lines will be longer sometimes. I am using
FindStr /I "string" file1 > file2
to do this operation. But in the resultant file, it is truncating the lines to 1024 characters. Is there any limitation in the dos programming that, the text file lines should be this much length only? If there is such limitation, then is there something we can set to override this behaviour.
Cheers, PK
发布评论
评论(1)
我不知道您的
findstr
是否有特定限制。就其价值而言,我在 XP SP3 下使用的程序至少可以在 2000 个字符行(a) 下正常工作。如果您的在某些方面有缺陷。您可能需要考虑下载 CygWin 或 grep 工具“http://gnuwin32.sourceforge.net/packages.html”rel="nofollow">GnuWin32(在包列表中搜索 grep)并使用它。但正如我所说,根据我的经验,不应该。
(a) 我创建了一个包含 2000 个字符的单行文件(重复序列
1234567890
),然后:I don't know if there's a specific limitation to your
findstr
. For what it's worth, the one I have under XP SP3 works fine up to at least 2000-character lines (a).If yours is deficient in some way. you may want to think about either downloading CygWin or the
grep
tool from GnuWin32 (search for grep in the package list) and using that instead. But as I say, based on my experience, it shouldn't be.(a) I created a single-line file with 2000 characters (repeating sequence of
1234567890
) and then: