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.

4
  • Your output does not match the expected output. Order is wrong. Commented Dec 17, 2019 at 16:20
  • @fpmurphy With applications like this the order rarely matters so it's not worth complicating the code to address something that almost certainly isn't an issue. If it is an issue then the OP can tell us and then it's a simple tweak to change the output order. Also, your own answer will produce output in random order (actually hash order) too courtesy of you also looping using the in operator and the fact you got output in the same order as shown in the question given this particular data set is just pure co-incidence. Commented Dec 17, 2019 at 16:45
  • -1 for output that does not match sample output provided by OP. Commented Dec 17, 2019 at 17:01
  • @fpmurphy Then give yourself -1 too because your code works exactly the same way mine does wrt the output order. The fact that with a given run of the code with a given input on a given machine using a given awk version produced one order of output for me and a different order of output for you is complete chance. Change your input or run your script with a different awk version or on a different machine and you'll get a different order of output. Commented Dec 17, 2019 at 17:14