I'm learning a bit of awk with a basic users.txt including names, ages and countries. The fact is I'm not being able to construct a ternary operator one-liner.
This is the file to work with:
John 23 Italy
David 18 Spain
Sarah 21 Germany
Dan 42 Germany
Brian 50 England
And this is my idea of the one-liner based on if-else condition:
awk '{$1 == "David" ? print "$1" : "Not David"}' users.txt
I achieved to work an if-else awk script but I'm trying to do it with this one-liner and I'm constantly getting syntax errors hence I'm not sure if I can do it this way. (awk is mandatory, please)