Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • Thanks that did the job! :) There is one thing i can't quite wrap my head around. FNR==NR{a[$1]=$2;next} will contain 5,9 or what exactly will the array a contain? If it contains 5,9 the check $1 in a{$3=a[$1]} does not make sense to me. Can you elaborate? Commented Jul 7, 2020 at 19:21
  • 1
    After reading file2.csv, the contents of array a are: a['alice']=5 and a['jessica']=9. The test $1 in a is true if the contents of $1 are one of the keys (not one of the values) of array a. Commented Jul 7, 2020 at 19:24
  • 1
    "if the contents of $1 in file1" Commented Jul 7, 2020 at 19:25
  • 1
    Thanks, that clarified it! Commented Jul 7, 2020 at 19:57