I am not entirely sure I understood the task (showing the expected output
would help). I basically understood "only output the lines if the value in
its first column is different in the line before/after". Is that it? If so,
here is a solution:
$ tr -s '\t' ' ' < selection.txt | tail -n +3 | sed 's/\([^ ]*\)\( [^ ]*
\)\(.*\)/\3\2\1/' | uniq -uf 2
188.120.236.138 188.120.236.138 alneo.ru
NXDOMAIN 91.240.86.50 alnitcorp.fvds.ru
92.242.140.21 82.146.42.228 alod.fvds.ru
62.109.12.147 62.109.12.147 aloe-slings.com
82.146.60.203 82.146.60.203 alohomora.ru
185.9.147.4 62.109.17.21 aloshop.ru
92.242.140.21 82.146.34.229 alosvlad.fvds.ru
212.109.193.28 212.109.193.28 alovera.ru
I assume that:
there is no space in the input file (tr -s '\t' ' ' changes the tabulations
to spaces because tabulations cannot be reliably used in 'sed'; tell me what
character cannot be used if the space can);
the input file is sorted w.r.t. the first column (if not, add " | sort" after
"tail -n +3" (which only aims to remove the first two lines);
you do not care having the first column becoming the last in the output (if
you care, pipe, at the end of the command, to the exact same 'sed' program as
used before; that program switches the first and the last column, because
'uniq' can only ignore the first fields with its option -f, not the last
fields);
you do not care having the space as the delimiter in the output (if you want
a tabulation, pipe, at the end of the command to "tr ' ' '\t'").