Awk string inequality doesn't seem to work

I have a file where I want to find all rows where columns three and four are different. My file looks like this:

chr1:109506687  [T/G]   BOT     TOP
chr1:109506690  [T/G]   BOT     TOP
...

The code I use to search for these lines is

awk '$3 != $4 {print $0}' Cardio-Metabo_Chip_11395247_A.txt | shuf -n 10

The problem is that with this command I get results like

rs3218791       [A/C]   TOP     TOP

If column three and four are the same.

When I use the conditional expression for equality, namely ==, I do not get a conclusion that tells me that awk never considers two columns $ 3 and $ 4 equal, despite the fact that they are often so.

Ps. using :set listin vim, my file looks like this:

chr1:109506687^I[T/G]^IBOT^ITOP$
chr1:109506690^I[T/G]^IBOT^ITOP$
....

My awk version is GNU Awk 3.1.8, but I can’t imagine that there is a lot to do. This should be correct in 1.0

What could be wrong?

+3
source
1

(. ), , , ( , "0"1). :

awk '$3 != $4 "" {print $0}' test

$4 .


mawk 1.2 gawk 4.0.1:

$ cat test
chr1:109506687  [T/G]   BOT     TOP
chr1:109506690  [T/G]   BOT     TOP
rs3218791       [A/C]   TOP     TOP
$ mawk '$3 != $4 {print $0}' test
chr1:109506687  [T/G]   BOT     TOP
chr1:109506690  [T/G]   BOT     TOP
$ gawk '$3 != $4 {print $0}' test
chr1:109506687  [T/G]   BOT     TOP
chr1:109506690  [T/G]   BOT     TOP

shuf , . (, , .)

: {print $0} , - . , awk '$3 != $4' awk '$3 != $4 {print $0}'... , .

+3

All Articles