We have a script that runs several commands and rolls up all the output and inserts in into a log file. One of the commands it runs is "netstat -anp". I'd like to be able to search this file for all runs of the command and filter for certain IP's. Is this possible with sed or awk if so what would the command look like?
For filtering data from file is better to use grep. For example:
With awk you can use something like:
To get IPs counted you can use
This will provide you uniq IPs with count |
|||||||||||||||||
|
I take it that "rolls up" means that all newlines are removed and the output of each command is thus "rolled up" to a single line. If so, your
Edit:
Your latest comment says you want to count how many times the IP address appears within a given interval. Since the
I'm assuming a POSIX or BSD-style |
||||
|