Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
element not in an array test in awk
# [reference 1](http://www.unix.com/302702781-post2.html)
# awesome in using Ternary Operator
awk '
BEGIN {
a["1"]="a";
a["2"]="b";
a["3"]="c";
}
{ print !( $1 in a) ? "x" : a[$1]; }
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.