awk if statement checking multiple arrays -
i have file this:
1 1 9 2 2 4 3 2 5 4 2 4 i want awk print unique records based on second , third field. both fields must unique printed.
the ideal output this:
1 1 9 2 2 4 3 2 5 so record 4, because identical record 2, left out.
this tried:
cat file | awk ' !($2 in array) && !($3 in barry) { array[$2]; barry[$3]; print}' running command results in:
1 1 9 2 2 4 so doesn't add record 3 because it's second field identical record 2's.
how go coding awk checks both values?
this should do:
awk '!a[$2,$3]++' file 1 1 9 2 2 4 3 2 5
Comments
Post a Comment