shell script needed for the following
shell script needed for the following
I have two files in the same directory: "host_list" and "known_hosts". host_list contains a list of servers. known_hosts contains the keys for each of the servers in host_list.
I want the script to take from host_list a server name and check (grep) all keys containing that server name in known_hosts. If the resulting keys contain 'sample' in the url, keep those keys. Otherwise delete the rest.
Here's an example:
In host_list, we have two servers: be3abcd3 and be3efgh4.
We check for mentions of be3abcd3 in known_hosts. That results in:
be3abcd3.300.200.100.50
and
be3abcd3.sample.com
The script will delete be3abcd3.300.200.100.50 and keep be3abcd3.sample.com, as that contains 'sample' in the url.

Step by step
Solved in 2 steps with 1 images









