windows下的类似linux下的grep命令——findstr

经常用linux下的grep命令,比如:

netstat -an|grep 1521
其实windows下也有一个类似的命令findstr,比如:
C:\Windows\system32>netstat -an|findstr 1521
TCP 0.0.0.0:1521 0.0.0.0:0 LISTENING

TCP192.168.1.100:1521192.168.1.100:49686ESTABLISHED

TCP192.168.1.100:1521192.168.1.100:49701ESTABLISHED

TCP192.168.1.100:1521192.168.1.100:49702ESTABLISHED

TCP192.168.1.100:1521192.168.1.100:49706ESTABLISHED

TCP192.168.1.100:1521192.168.1.100:49707ESTABLISHED

TCP192.168.1.100:1521192.168.1.100:49753ESTABLISHED

TCP192.168.1.100:49686192.168.1.100:1521ESTABLISHED

TCP192.168.1.100:49701192.168.1.100:1521ESTABLISHED

TCP192.168.1.100:49702192.168.1.100:1521ESTABLISHED

TCP192.168.1.100:49706192.168.1.100:1521ESTABLISHED

TCP192.168.1.100:49707192.168.1.100:1521ESTABLISHED

TCP192.168.1.100:49753192.168.1.100:1521ESTABLISHED

TCP [::]:1521 [::]:0 LISTENING
当然windows下还有一个find命令,比如:
C:\Windows\system32>netstat -an|find "1521"

TCP0.0.0.0:15210.0.0.0:0LISTENING

TCP192.168.1.100:1521192.168.1.100:49686ESTABLISHED

TCP192.168.1.100:1521192.168.1.100:49701ESTABLISHED

TCP192.168.1.100:1521192.168.1.100:49702ESTABLISHED

TCP192.168.1.100:1521192.168.1.100:49706ESTABLISHED

TCP192.168.1.100:1521192.168.1.100:49707ESTABLISHED

TCP192.168.1.100:1521192.168.1.100:49753ESTABLISHED

TCP192.168.1.100:49686192.168.1.100:1521ESTABLISHED

TCP192.168.1.100:49701192.168.1.100:1521ESTABLISHED

TCP192.168.1.100:49702192.168.1.100:1521ESTABLISHED

TCP192.168.1.100:49706192.168.1.100:1521ESTABLISHED

TCP192.168.1.100:49707192.168.1.100:1521ESTABLISHED

TCP192.168.1.100:49753192.168.1.100:1521ESTABLISHED

TCP [::]:1521 [::]:0 LISTENING
两个命令的区别是find需要用引号引起来。