Sublime Forum

Copy text blocks after every line matching a regex

#1

I want to use Sublime Text to add a text block after every line that matches a regex. Any way I can do this?

What I want to do it this:

  • I have a file with a large number of statements like the following:
    CREATE EXTERNAL TABLE IF NOT EXISTS myks.mytable (
    my_id varchar(36),
    filter_id varchar(36),
    PRIMARY KEY (my_id, filter_id) DISABLE NOVALIDATE
    );

  • I want to add a line:
    ALTER TABLE myks.mytable SET TBLPROPERTIES (…);
    after every
    CREATE EXTERNAL TABLE IF NOT EXISTS myks.mytable ( … );

Is this a function I can make efficient in Sublime?

0 Likes

#2

That sounds like straight search and replace. What bit are you having difficulty with, exactly?

0 Likes