FINDSTR: Line is too long
Solution 1:
SS64's FINDSTR - Escapes and Length limits says:
Line Length limits
Files specified as a command line argument or via the
/F:FILE
option have no known line length limit. Searches were successfully run against a 128MB file that did not contain a single <LF>.Piped data and Redirected input is limited to 8191 bytes per line. This limit is a "feature" of FINDSTR. It is not inherent to pipes or redirection. FINDSTR using redirected stdin or piped input will never match any line that is >=8k bytes. Lines >= 8k generate an error message to stderr, but ERRORLEVEL is still 0 if the search string is found in at least one line of at least one file.
Credits:
Dave Benham - List of undocumented features and limitations of FINDSTR from StackOverflow
Solution 2:
The better built-in alternative would be PowerShell's Select-String (or its alias sls
)
The
Select-String
cmdlet searches for text and text patterns in input strings and files. You can useSelect-String
similar togrep
in UNIX orfindstr.exe
in Windows.Select-String
Just be aware that Select-String
does a case-insensitive search by default, unlike most alternatives