Question: I want to remove duplicated columns/fields on the same row only. I tried, but I ended up with a long code with nest loops, conditions and arrays that doesn't work correctly.

* input data:

```
1 2 3 4
1 2 3 1
1 2 1 3
4 4 3 2
3 3 3 2
1 1 1 1
5 2 2 7

```
* desired output:

```
1 2 3 4
1 2 3 
1 2 3
4 3 2
3 2
1
5 2 7

```

Answer: 
Use text only for your demos.

Use parentheses around your expression:

```bsh
$ awk 'BEGIN{print (5>3 ? "Hello":"World")}'
Hello
$ awk 'BEGIN{print (3>5 ? "Hello":"World")}'
World

```

May be, `>` character is interpreted like a redirection to a file for print command
Your code has an unparenthesized ternary expression [possibly] on the right side of output redirection. There are 2 issues with that:

* An unparenthesized expression on the right side of output (or input)
redirection is undefined behavior per POSIX so never do that.
* An uparenthesized ternary expression is harder to read than one with
parentheses and can lead to syntax errors in some awks in some
contexts so never do that either.

Bad:

```
print > foo bar
getline < foo bar
str = x>y ? foo : bar

```

Good:

```
print > (foo bar)
getline < (foo bar)
str = (x>y ? foo : bar)

```

When creating multiple output files, though, it's usually a good idea to close them as you go and then you would store the output file name that's the result of the expression in a variable and then you don't need parens, e.g.:

```
out = foo bar
print > out
close(out)

```

So your code:

```
awk 'BEGIN{print 3<5 ? "Hello" : "World"}'
awk 'BEGIN{print 3>5 ? "hello" : "world"}'
awk 'BEGIN{print 5<3 ? "Hello" : "World"}'

```

which, depending on what it's supposed to do, is either not using parens on the right side of output redirection or not using parens around a ternary or both and so should instead be written as:

```
awk 'BEGIN{print (3<5 ? "Hello" : "World")}'
awk 'BEGIN{print (3>5 ? "hello" : "world")}'
    or, less likely, awk 'BEGIN{print 3 > (5 ? "hello" : "world")}'
awk 'BEGIN{print (5<3 ? "Hello" : "World")}'

```