MoonPoint Support Logo

 

Shop Amazon Warehouse Deals - Deep Discounts on Open-box and Used ProductsAmazon Warehouse Deals



Advanced Search
June
Sun Mon Tue Wed Thu Fri Sat
     
27    
2016
Months
Jun


Mon, Jun 27, 2016 10:27 pm

Using an "or" operator with the findstr command

You can perform logical "or" operations on Microsoft Windows systems with the findstr command using the pipe character, i.e., |, to separate the terms you wish to search on. E.g., if I wanted to filter the output of the netstat command to search for any lines that contain either ":21", ":22", or ":990", I could use the command below.
C:\>netstat -an | findstr ":21 | :22 | :990"
  TCP    0.0.0.0:21             0.0.0.0:0              LISTENING
  TCP    0.0.0.0:22             0.0.0.0:0              LISTENING
  TCP    0.0.0.0:990            0.0.0.0:0              LISTENING

C:\>

References:

  1. FINDSTR
    SS64 | Command line reference

[/os/windows/commands] permanent link

Valid HTML 4.01 Transitional

Privacy Policy   Contact

Blosxom logo