Hello,
I have a text file containing IP information, the IP address is in the first column of the file. What I want to do is match a range in the first octet, I'm new to scripting so I'm a little confused. Heres what I have tried.
awk '$1 ~ /[192 - 196].168.0.1/' samplelog
so basically I want to see all the IP address that start with 192.168.0.1 to 196.168.0.1.
This is part of a larger script and I have hard coded the last 3 (168.0.1) parts of the address just so I could illistrate my problem. Their are 6 colums in this log file so I don't really want to change my field separator (to '.')and then check the values that way, but it's starting to to look like I might have to.
I would be very grateful for any ideas you might have,
Mark Moesker.
Ottawa, Canada
I have a text file containing IP information, the IP address is in the first column of the file. What I want to do is match a range in the first octet, I'm new to scripting so I'm a little confused. Heres what I have tried.
awk '$1 ~ /[192 - 196].168.0.1/' samplelog
so basically I want to see all the IP address that start with 192.168.0.1 to 196.168.0.1.
This is part of a larger script and I have hard coded the last 3 (168.0.1) parts of the address just so I could illistrate my problem. Their are 6 colums in this log file so I don't really want to change my field separator (to '.')and then check the values that way, but it's starting to to look like I might have to.
I would be very grateful for any ideas you might have,
Mark Moesker.
Ottawa, Canada