I have to compare the IPs of two different
/etc/hosts files and show a diff in side-by-side view.
10.244.74.152 REF_UP-4 10.244.74.154 REF_UP-5 10.244.74.156 REF_UP-6 10.244.74.153 REF_UP-7 10.244.74.155 REF_UP-8 10.244.74.157 REF_UP-9 10.244.74.159 REF_UP-10 10.244.74.160 REF_UP-11
10.244.74.152 REF_UP-4-new 10.244.74.154 REF_UP-5-new 10.244.74.156 REF_UP-6-new 10.244.74.153 REF_UP-7-new 10.244.74.155 REF_UP-8-new 10.244.74.157 REF_UP-9-new 10.244.74.160 REF_UP-11-new
And my expected output
< 10.244.74.159 REF_UP-10
I already sorted the entries by IP and used
diff <(cut -f1 hosts_sorted) <(cut -f1 hosts_new_sorted). Howwever, this cuts out the hostnames which are needed. Is there a way to tell diff only to use the first column? However the comparison shall not include the second column.