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*

5
  • Doesn't seem to work @terdon. I'm getting the following error: awk: syntax error at source line 1 context is >>> {a[$2][ <<< awk: illegal statement at source line 1 Commented Feb 11, 2015 at 9:50
  • @Sri what operating system are you using? Commented Feb 11, 2015 at 10:00
  • @tendon I'm using Mac OSX V10.9.5 Commented Feb 11, 2015 at 12:31
  • @Sri see updated answer. The awk on OSX is different from that on Linux. Next time, please remember to include your OS in your question. Commented Feb 11, 2015 at 21:10
  • @tendon I will keep that in mind. The Perl solution worked for my case. Thank you very much for the help! Commented Feb 12, 2015 at 2:40