Tweeted twitter.com/#!/StackUnix/status/637948173546299392
4 edited tags
| link
3 edited title
| link

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

2 added 264 characters in body
source | link

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

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

How could I get:

START
All this code
on all these lines
END

?

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
1
source | link