Skip to main content
2 of 4
added 264 characters in body
Michael Durrant
  • 43.8k
  • 73
  • 176
  • 238

How to add a header or footer to a sed or awk stream?

I have a bunch of output going through sed and awk.

How can I prefix the output with START and suffix the answer with END?

For example, if I have

All this code on all these lines and all these 

How could I get:

START All this code on all these lines and all these END 

?

My attempt was:

awk '{print "START";print;print "END"}' 

but I got

... START All this code END START on all these lines END START and all these END 
Michael Durrant
  • 43.8k
  • 73
  • 176
  • 238