0
findstr /i /s /g:ip-pool.txt *.txt > result.txt

This is what I am inputting into the batch file and it seems to do the trick. The only issue is that when searching a certain ip address or string, it will print all occurrences. What I am trying to figure out is how it can only print me out one occurrence per hit. So for example:

1.1.1.1
1.1.1.1
1.1.1.1
1.2.1.2
1.2.1.2
1.2.1.2
1.3.1.3
1.3.1.3
1.3.1.3

To come out at the end like:

1.1.1.1
1.2.1.2
1.3.1.3

Does not have to necessarily be ip addresses, just would like one searched string be outputted once instead of several (hundred) times.

Any help would be greatly appreciated.

Thanks!

chocopie
  • 1
  • 1
  • I guess that would be really painful to do in batch. However, let's clarify some things here. Since you are searching inside a lot of *.txt files, wouldn't be useful if you knew where you found an occurrence? And if you have a lot of search strings, would it be better if the output was: and so on? I'm thinking of possibilities here, if those mentioned are helpful, tell us (maybe edit question) =) – Daniel Luz Dec 11 '15 at 13:25
  • Can we assume that duplicate lines are always in succession? – RGuggisberg Dec 11 '15 at 13:31
  • Cannot really determine the occurrences as they are random. Determine connections made by a user and checking those connections against another file to see if that user had connected before. Joe [1.1.1.2/ABCD1234] Then when using the batch file to search for ABCD1234 or 1.1.1.2, would like to just see one instance of Joe connecting instead of more than once. – chocopie Dec 11 '15 at 13:59

0 Answers0