What have you tried? This sort of problem has been addressed on the site multiple times
sed can match the first character of each line to pick lines where an operation is performed - you can use that to restrict the operation to just header lines. You can also capture the last five characters with the regex
Please use these hints to get to the solution.