0

Hi,
I have the a file which contains information as mentioned in the below format.

IP:20.20.20.50 DLBytes:0 
IP:0.0.0.0/0 DLBytes:0 
IP:20.20.20.52 DLBytes:0 
IP:0.0.0.0/0 DLBytes:0 
IP:20.20.20.53 DLBytes:187329 
IP:0.0.0.0/0 DLBytes:17176 
IP:0.0.0.0/0 ULBytes:0 
IP:20.20.20.50 ULBytes:0 
IP:0.0.0.0/0 ULBytes:0 
IP:20.20.20.52 ULBytes:0 
IP:0.0.0.0/0 ULBytes:187329 
IP:20.20.20.53 ULBytes:17176

I am using below commands to extract entries which have proper ip address and value of DLBbytes or ULBbytes greater than zero.

grep -v "0.0.0.0" | grep -vw "DLBbytes:0" | grep -vw "ULBbytes:0"
grep -v "0.0.0.0" | grep -vw "DLBbytes:0" | grep -vw "ULBbytes:0"

that means the entries like IP:0.0.0.0/0 DLBytes:0 , IP:20.20.20.xx DLBytes:0 should be discarded.

But i am getting the out put as below

IP:20.20.20.50 DLBytes:0 
IP:20.20.20.52 DLBytes:0 
IP:20.20.20.53 DLBytes:187329 
IP:20.20.20.50 ULBytes:0 
IP:20.20.20.52 ULBytes:0 
IP:20.20.20.53 ULBytes:17176

but if i use

ehco "IP:20.20.20.50 DLBytes:0" | grep -vw "DLBbytes:0" 

its working.

so why its not working in the first case, and how to do it.

2
Contributors
2
Replies
18
Views
2 Years
Discussion Span
Last Post by clife
0

Hello,

You havean extra b in your grep. try this:

grep -v "0.0.0.0" | grep -vw "DLBytes:0" | grep -vw "ULBytes:0"

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.