how can I add grep output number line by line.
I have the below output file from
pkts bytes target prot opt in out source destination
0 0 RETURN 0 -- * * 0.0.0.0/0 192.168.1.117
0 0 RETURN 0 -- * * 192.168.0.1 0.0.0.0/0
0 0 RETURN 0 -- * * 0.0.0.0/0 192.168.0.1
375993 19581223 RETURN 0 -- * * 192.168.1.136 0.0.0.0/0
752537 1043650417 RETURN 0 -- * * 0.0.0.0/0 192.168.1.136
123 9348 RETURN 0 -- * * 192.168.1.100 0.0.0.0/0
121 9196 RETURN 0 -- * * 0.0.0.0/0 192.168.1.100
I want to add all bytes for each IP address and store it as variable for further calculation.
iptables -L RRDIPT -vnx -t filter | grep "192.168.1" | cut -d " " -f4
gives me the blanks and 19581223,1043650417,9348 and 9196 but I am struggling to add the output.
Can anyone guide me?