Similar to a question posted by me here earlier, am looking for a help in Linux command that performs/does the following that is subtle different from my original question:
Searches for a particular word/phrase case-insensitively in a given file, and then insert/prefix with the character
-- (in this case, this is an SQL comment) in the immediate next 'n' lines including the line where the word/phrase was matched in the given file.
If I try to search for the phrase "CREATE FUNCTION plpgsql_call_handler" case-insensitively and if it matches at line no.102644, then I expect to insert/prefix the character
-- in line no.102644 and the immediate next 2 lines in the given file. In this case, I expect to insert/prefix line nos. 102644,102645,102646 with the character
102644 CREATE FUNCTION plpgsql_call_handler() RETURNS language_handler 102645 AS '/usr/lib/pgsql/plpgsql.so', 'plpgsql_call_handler' 102646 LANGUAGE c;
I expect/want it to be changed into (in this case, it is an SQL comment):
102644 -- CREATE FUNCTION plpgsql_call_handler() RETURNS language_handler 102645 -- AS '/usr/lib/pgsql/plpgsql.so', 'plpgsql_call_handler' 102646 -- LANGUAGE c;