How to grep two IP addresses and increase the value of the last number?

Viewed 1369

I'm pretty new to Linux and writing scripts etc. I have this task where I need to find an IP-address from a database and then grep a bunch of files with this IP and the next one to see, if they have any presence there. Currently I have to first write:

rwhois -Br 0.0.0.0

and then

grep -wl '0.0.0.0\|0.0.0.1' /path/to/some/files

And I have to manually change the last digit from the rwhois and from the grep. I got as far as to write a simple function like this

function info () {
    rhowis -Br $1
    grep -w '$1\|$1'
}

But of course I'd have to somehow increase the value of the latter input by 1. Any good advice? And a small explanation of what you changed is appreciated so I can learn from this. Thanks!

2 Answers
Related