Search code examples
cmdfind

Add Multiple Searches in cmd Find Command


I am looking for adding array or multiple searches in the Find command of cmd but as soon i tried it do nothing following command worked fine with one input.

For one Input:

Find /V "/1001214955/" Scan-FtpOut.txt > Ftp_New.txt

For multiple inputs:

Find /V "/1001214955/ | /WENP/ " Scan-FtpOut.txt > Ftp_New.txt
Find /V "/1001214955/ -o /WENP/" Scan-FtpOut.txt > Ftp_New.txt

nothing is working please assist.


Solution

  • As a follow up to my comment, and to show you that my commented commands work exactly as given, (to remove all lines within Scan-FtpOut.txt which contain the exact string /1001214955/ or which contain the exact case sensitive string /WENP/, and output those to Ftp_New.txt).

    Here is an example Scan-FtpOut.txt file:

          200 PORT command successful.
          150 Opening data connection for /WENP/Faketest (467 bytes).
          226 Transfer complete.
          467 bytes transferred in 2.845 seconds. Transfer rate 0.167KB/sec.
    
          200 PORT command successful.
          150 Opening data connection for /1001214955/Faketest (467 bytes).
          226 Transfer complete.
          467 bytes transferred in 2.845 seconds. Transfer rate 0.167KB/sec.
    
    

    Here are the contents of Ftp_New.txt after running @%SystemRoot%\System32\findstr.exe /R /V "\/1001214955\/ \/WENP\/" "Scan-FtpOut.txt" 1>"Ftp_New.txt":

          200 PORT command successful.
          226 Transfer complete.
          467 bytes transferred in 2.845 seconds. Transfer rate 0.167KB/sec.
    
          200 PORT command successful.
          226 Transfer complete.
          467 bytes transferred in 2.845 seconds. Transfer rate 0.167KB/sec.
    
    

    Here are the contents of Ftp_New.txt after running @%SystemRoot%\System32\findstr.exe /R /V "[/]1001214955[/] [/]WENP[/]" "Scan-FtpOut.txt" 1>"Ftp_New.txt":

          200 PORT command successful.
          226 Transfer complete.
          467 bytes transferred in 2.845 seconds. Transfer rate 0.167KB/sec.
    
          200 PORT command successful.
          226 Transfer complete.
          467 bytes transferred in 2.845 seconds. Transfer rate 0.167KB/sec
    

    Here are the contents of Ftp_New.txt after running @%SystemRoot%\System32\findstr.exe /L /V /C:"/1001214955/" /C:"/WENP/" "Scan-FtpOut.txt" 1>"Ftp_New.txt":

          200 PORT command successful.
          226 Transfer complete.
          467 bytes transferred in 2.845 seconds. Transfer rate 0.167KB/sec.
    
          200 PORT command successful.
          226 Transfer complete.
          467 bytes transferred in 2.845 seconds. Transfer rate 0.167KB/sec
    

    As you can see the results of each of my initially offered commands show exactly the intended results!