desperado618
MIS
I am struggling to write a script that will display the # of times an IP address appears as a source and as a destination.
Elements:
##the user should be prompted for the ip address
echo "Enter IP"
read $ip
##the files are in *.gz format
zcat *.gz | grep $ip #displays all lines with that ip
#src=<ip> and dst=<ip>
##the src address is in position 7 and dst in position 10
awk {print $7,$10}
### count the lines
wc -l
I cant seem to put everything together. The best I have been able to accomplish is to get a total count of any line that either has the ip listed as a src or dst. Any assistance would be greatly appreciated.
Elements:
##the user should be prompted for the ip address
echo "Enter IP"
read $ip
##the files are in *.gz format
zcat *.gz | grep $ip #displays all lines with that ip
#src=<ip> and dst=<ip>
##the src address is in position 7 and dst in position 10
awk {print $7,$10}
### count the lines
wc -l
I cant seem to put everything together. The best I have been able to accomplish is to get a total count of any line that either has the ip listed as a src or dst. Any assistance would be greatly appreciated.