title: findstr: search strings too long
body: <p>I am trying to compare a list of IP's and output the difference by using the findstr command in Windows and am having difficulty getting it to work. The command I am using is:</p>
  
  <p>EDIT: My objective is to compare IP's that were scanned successfully to IP's that were scanned successfully with authentication achieved and output it the files that aren't in <strong>IPsSuccessfullyScannedwithAuthentication.txt</strong> but are in <strong>IPsSuccessfullyScanned.txt</strong> to <strong>IPsSuccessfullyScannedButNotAuthenticated.txt</strong>.</p>
  
  <p>Let's say <strong>IPsSuccessfullyScanned.txt</strong> contain</p>
  
  <blockquote>
    <p>192.168.0.1</p>
    
    <p>192.168.0.2</p>
    
    <p>192.168.0.3</p>
    
    <p>192.168.0.4</p>
    
    <p>192.168.0.5</p>
    
    <p>192.168.0.6</p>
    
    <p>192.168.0.7</p>
    
    <p>192.168.0.8-192.168.0.12</p>
  </blockquote>
  
  <p>and <strong>IPsSuccessfullyScannedwithAuthentication.txt</strong> (which are the IP's that authenticated and were successfully scanned) contain</p>
  
  <blockquote>
    <p>192.168.0.1</p>
    
    <p>192.168.0.2</p>
    
    <p>192.168.0.3</p>
    
    <p>192.168.0.4</p>
    
    <p>192.168.0.6</p>
    
    <p>192.168.0.8-192.168.0.10</p>
    
    <p>192.168.0.12</p>
  </blockquote>
  
  <p>My <strong>IPsSuccessfullyScannedButNotAuthenticated.txt</strong> should have this:</p>
  
  <blockquote>
    <p>192.168.0.5</p>
    
    <p>192.168.0.7</p>
    
    <p>192.168.0.11</p>
  </blockquote>
  
  <p><strong>findstr /vixg:IPsSuccessfullyScanned.txt IPsSuccessfullyScannedwithAuthentication.txt > IPsSuccessfullyScannedButNotAuthenticated.txt</strong></p>
  
  <p>What I am trying to achieve is very similar to this post:</p>
  
  <p><a href="https://stackoverflow.com/questions/13045754/bat-file-to-compare-two-text-files-and-output-the-difference">.bat file to compare two text files and output the difference</a></p>
  
  <p>Here is my issue though, the file size in the IPs2.txt is 720 bytes. 
  When I researched about the findstr command, I found out that when doing a regular expression search, the maximum search string length is 254 bytes. A regular expression with length between 255 bytes and 511 bytes will result in a FINDSTR: Out of memory error with ERRORLEVEL 2. </p>
  
  <p>A regular expression length >511 bytes results in the <strong>FINDSTR: Search string too long. error.</strong> <strong>(which is the error I'm currently getting)</strong>.</p>
  
  <p>My question is: What alternatives are out there that I can use to be able to compare the two text files? If there are any other suggestions to resolve my issue as easy as possible, even a bat file can help if possible. </p>
  
  <p>References:</p>
  
  <p><a href="http://ss64.com/nt/findstr-escapes.html" rel="nofollow noreferrer">http://ss64.com/nt/findstr-escapes.html</a> </p>
  
  <p><a href="https://stackoverflow.com/questions/8844868/what-are-the-undocumented-features-and-limitations-of-the-windows-findstr-comman">What are the undocumented features and limitations of the Windows FINDSTR command?</a></p>