I want to comment(#) 6 lines before and after the matched pattern. I referred this question.
How do I delete a matching line, the line above and the one below it, using sed?
I tried to use hold buffer for this solution, but not working.
I have the following sequence occurring multiple times in a file:
aaaa
bbbb
cccc
dddd
eeee
ffff
gggg
hhhh
iiii
jjjj
kkkk
llll
mmmm
nnnn
oooo
If I searched hhhh
, then the output file should be given below:
aaaa
#bbbb
#cccc
#dddd
#eeee
#ffff
#gggg
#hhhh
#iiii
#jjjj
#kkkk
#llll
#mmmm
#nnnn
oooo
Please help me to do this with sed or any other scripts!!!