Thanks for your feedback on the articles. Regarding the question: sed and awk are very different, though some requirements have simple solutions in both awk and sed. However, in many cases, its not so because they both are primarily meant for different things.
For your question, sed is the ideal candidate, not awk since expression handling in awk is not that great. Anyways, the answer in awk is as below: