Consider the following DB schema:
CREATE UNIQUE INDEX blah1 ON table1(length);
CREATE INDEX blah2 ON table3(name);
CREATE INDEX blah3 ON table3 USING btree(id);
I want to write a small awk script that would return the names of the indices and tables, e.g.:
blah1, table1
blah2, table2
blah3, table3
I need to match the word that comes after the word INDEX and the word that comes after the word ON and ends with ( or whitespace.
Any idea how to do it using a regex match, without iterating over all $NFs?
I don’t know awk well, but this seems to work: