Search code examples
pythonpython-2.7fabricfindstr

Python fabric findstr string length


I am sending a command via fabric to windows hosts...

commmand1 = "findstr -i '" + string + "' 'D:\file\path\" + dat + "*'"

Works correctly if I don't try and search too many characters at once. Searching over 173 characters (which works in the local command line). Yields the error...

/bin/sh: -c: line 0: unexpected EOF while looking for matching `''
/bin/sh: -c: line 1: syntax error: unexpected end of file

Solution

  • Perhaps the limitation is system or text expression specific. Since I am able to execute the command locally.

    http://blog.johnmuellerbooks.com/2013/06/14/limitations-of-the-findstr-utility/

    There is a real limit on the length of your search string. The utility appears to have a search string length limitation.