How to grep commands output in windows | grep command for windows

Posted on January 12, 2017

0


How to grep commands output in windows

 

If you want to grep specific output, use find command. Find below examples for reference.

 

netstat –n –a

TCP   192.168.32.241:56847   40.77.226.192:443                 ESTABLISHED

TCP   192.168.32.241:56870   40.77.229.39:443                    ESTABLISHED

TCP   192.168.32.241:56873   40.77.229.64:443                  ESTABLISHED

TCP   192.168.32.241:56925   108.160.172.204:443            TIME_WAIT

TCP   192.168.169.1:139         0.0.0.0:0                                    LISTENING

TCP   192.168.234.1:139        0.0.0.0:0                                    LISTENING

 

netstat –n –a | find “40.77.226.192:443”

 

TCP   192.168.32.241:56847   40.77.226.192:443                 ESTABLISHED

 

netstat –n –a | find “40.77.226.192:443”

 

TCP   0.0.0.0:443           0.0.0.0:0             LISTENING

TCP   192.168.32.241:56350   45.58.74.161:443       CLOSE_WAIT

TCP   192.168.32.241:56676   40.101.45.82:443       ESTABLISHED

TCP   192.168.32.241:56678   40.101.45.82:443       ESTABLISHED

TCP   192.168.32.241:56679   91.190.216.61:443     ESTABLISHED

TCP   192.168.32.241:56683   162.125.34.129:443     ESTABLISHED

TCP   192.168.32.241:56685   40.77.229.56:443       ESTABLISHED

TCP   192.168.32.241:56689   40.77.229.28:443       ESTABLISHED

TCP   192.168.32.241:56691   40.101.45.82:443       ESTABLISHED

TCP   192.168.32.241:56695   40.101.45.82:443      ESTABLISHED

……..

 

netstat –n –a | find “40.77.226.192:”

 

TCP   192.168.32.241:56847   40.77.226.192:443     ESTABLISHED

 

 

Now if you want to grep specific output and then count the lines, use find command with C option. Find below examples for reference.

netstat -n -a |find /C “40.77.226.192:”

1

 

netstat -n -a |find /C “:443”

18

 

netstat -n -a |find “:443” |find/C “LISTENING

1

Advertisements
Posted in: Tech News