But you still have to scan the output manually to find the port you are looking for.
In the Unix world you could simply use grep and pipe the output to it.
In the DOS world, you can use find.
help find
Searches for a text string in a file or files.
FIND [/V] [/C] [/N] [/I] [/OFF[LINE]] "string" [[drive:][path]filename[ ...]]
/V Displays all lines NOT containing the specified string.
/C Displays only the count of lines containing the string.
/N Displays line numbers with the displayed lines.
/I Ignores the case of characters when searching for the string.
/OFF[LINE] Do not skip files with offline attribute set.
"string" Specifies the text string to find.
[drive:][path]filename
Specifies a file or files to search.
If a path is not specified, FIND searches the text typed at the prompt
or piped from another command.
So to find if port 86 was open, use:
netstat -ano | find /i "86"
and the filtered output would something like:
TCP 0.0.0.0:86 0.0.0.0:0 LISTENING 728
UDP 0.0.0.0:86 *:* 728
Enjoy!
4 comments:
Thank you, this works great for finding strings in command output like net statistics.
grt Berto
Yeah, this was an awesome post. Really really useful for all command line users. Kudos!
Thanks! FIND command was just what I needed.
curious - why ignore the case of numbers?
but thanks for the find!
Post a Comment