I have a file (A) that contains:
Host1
bge0: xx.xxx.xx.xxx
bge1: xx.xxx.xx.xxx
Host2
bge0: xx.xxx.xx.xx
bge1: xx.xxx.xx.xx
.
.
.
Another file (B) contains:
Host1-db xx.xxx.xx.xxx
Host2-nbu xx.xxx.xx.xxx
Host1-app xx.xxx.xx.xxx
What I want to do is if the IP in file (B) in column 2 matches an IP in file (A) then print column 1 from file B next to the IP in file A.
For example:
Host1
bge0: xx.xxx.xx.xxx Host1-db
bge1: xx.xxx.xx.xxx Host1-app
Host2
bge0: xx.xxx.xx.xx Host2-app
bge1: xx.xxx.xx.xx Host2-nbu
.
.
.
Thanks!
Host1
bge0: xx.xxx.xx.xxx
bge1: xx.xxx.xx.xxx
Host2
bge0: xx.xxx.xx.xx
bge1: xx.xxx.xx.xx
.
.
.
Another file (B) contains:
Host1-db xx.xxx.xx.xxx
Host2-nbu xx.xxx.xx.xxx
Host1-app xx.xxx.xx.xxx
What I want to do is if the IP in file (B) in column 2 matches an IP in file (A) then print column 1 from file B next to the IP in file A.
For example:
Host1
bge0: xx.xxx.xx.xxx Host1-db
bge1: xx.xxx.xx.xxx Host1-app
Host2
bge0: xx.xxx.xx.xx Host2-app
bge1: xx.xxx.xx.xx Host2-nbu
.
.
.
Thanks!