I need to find and replace in multiple files in the same directory(Aware of Find in Files tab) for the below scenario in Notepad++.
File1 Find:
1. REM INSERTING INTO TABLE1
2. SET DEFINE OFF;
3. INSERT INTO TABLE1 VALUES(....);
File1 Replace:
1. REM INSERTING INTO TABLE1
2. SET DEFINE OFF;
3. CALL CUSTOM_PACK.PROC_NAME('TABLE1');
4. INSERT INTO TABLE1 VALUES(....);
5. COMMIT;
6. CALL CUSTOM_PACK.PROC_NAME('TABLE1');
File2 Find:
1. REM INSERTING INTO TABLE2
2. SET DEFINE OFF;
3. INSERT INTO TABLE2 VALUES(....);
File2 Replace:
1. REM INSERTING INTO TABLE2
2. SET DEFINE OFF;
3. CALL CUSTOM_PACK.PROC_NAME('TABLE2');
4. INSERT INTO TABLE2 VALUES(....);
5. COMMIT;
6. CALL CUSTOM_PACK.PROC_NAME('TABLE2');
and so on... Whereas New line 3,5,6 should be auto generated from TABLENAME. Any help would be appreciated.
For each file, you may try the following find and replace, in regex mode:
Find: 1\. REM INSERTING INTO (\w+)\R2\. SET DEFINE OFF;\R3\. INSERT INTO \1 VALUES\(\.\.\.\.\);
Replace: 1. REM INSERTING INTO $1\n2. SET DEFINE OFF;\n3. CALL CUSTOM_PACK.PROC_NAME\('$1'\);\n4. INSERT INTO $1 VALUES\(....\);\n5. COMMIT;\n6. CALL CUSTOM_PACK.PROC_NAME\('$1'\);
For an explanation, the pattern captures the table name from the first line, and then uses that table name when building the new lines.