I have a very large file where I need to search for 40 patterns. If pattern got matched in the file then need to comment before 2 lines and after 2 lines. Patterns will be like as shown below:
1.create_rev -name "2x_8_PLL"
2.create_generated_rev -name "76_L"
3.create_rev -name "PCS_T0"
4.create_generated_rev -name "x544_P"
If I need to search for single pattern then I can execute below gvim command to accomplish the task.
:g/create_rev -name "2x_8_PLL"/-2,+2s/^/#
But the search patterns are more in number 40 plus. How to search/grep for 40+ patterns such that my expected output as shown below:
#pp
#oo
create_rev -name "2x_8_PLL"
#aa
#bb
hh
#ii
#jj
create_generated_rev -name "76_L"
#cc
#dd
create_rev -name "PCS_T0"
#ee
#ff
gg