In unix.com we encourage all users to do add their efforts which they have put to solve their own problem so kindly do add the same and let us know then.
It's also an easy task in python as well, but I'll leave that up to you. Note: I don't process text files with awk , so I cannot help you there sorry. However, what I can say is that this post is the "last straw" and as of today, our forum rules are forever changed:
Show your own work first, before asking a question! Do not go to the Internet asking people to write all your code for you!!
If you want a solution, in awk, post what you have attempted yourself in awk FIRST. Show YOUR own work..
Please note:
As mentioned, this post was "the final event" of people asking others to write all their code for them; and so I have finally made a long promised rule change, effective today: