awk help printing only if element is new in array
so far
I could build array using Code:
name_list[$3] = 1 how do I print only if element is new in array? |
Quote:
Daniel B. Martin |
say data is..
Code:
aaa 123 Code:
name_list[$1] = 1 it should only print out first 1st column encountered data so desired output is.. Code:
aaa 123 |
hmmm
this code actually worked for that matter Code:
if (name_list[$3] == 0){ |
Using your example:
Code:
awk '!_[$1]++' file |
And in case you're wondering how grail's line works, it's basically entry #43 here:
http://www.catonmat.net/blog/awk-one...ined-part-two/ |
All times are GMT -5. The time now is 02:59 PM. |