I have the following content:
void function_1() {
Using sed, I want to insert a line on the INSERT LINE HERE shortcut. The easiest way:
- find the text "function_1"
- skip 3 lines
- add new line
But none of the known sed options does this work.
sed '/function_1/,3a new_text
inserts new_text immediately after 'function_1'
sed '/function_1/,+3a new_text
inserts new_text after each of the next 3 lines, following "function_1"
sed '/function_1/N;N;N; a new_text
inserts new_text in several non-template locations
Thanks.
source share