Reputation: 1439
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
Upvotes: 1
Views: 1162
Reputation: 881623
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:
C:\Pax> \cygwin\bin\wc xyz.txt
1 1 2002 xyz.txt
C:\Pax> findstr /i "123" xyz.txt >xyz2.txt
C:\Pax> \cygwin\bin\wc xyz2.txt
1 1 2002 xyz2.txt
Upvotes: 3