Sed Question 1. (Don't quite know how to use sed! Thanks)

  1. Write a sed script to extract the year, rank, and stock for the most recent 10 years available in the file top10_mktval.csv, and output in the following format:
 [LEFT]  \------------------------------

[/LEFT]

YEAR |RANK| STOCK
------------------------------
2007 | 1 | Exxon Mobil
2007 | 2 | Genl Electric
2007 | 3 | Microsoft Corp
2007 | 4 | AT&T Inc
2007 | 5 | Procter & Gamble
2007 | 6 | Google Inc'A'
2007 | 7 | Chevron Corp
2007 | 8 | Johnson & Johnson
2007 | 9 | Wal-Mart Stores
2007 | 10 | Bank of America
2006 | 1 | Exxon Mobil
...

Observe that:

  • Headers are added.
  • Rank is now the second field.
  • The last two fields in the original file are not printed.
  • The delimiters '|' are aligned.

You may assume that the records in this file are always in reverse chronological order, and there are always 10 entries (ranked 1-10) for each year.

top10_mktval.csv is in the attachment

Thank you !

smells like homework to me