I have a below awk command which is looking into "test.sql" file (which has multiple CREATE TABLE statements), I want to generate multiple files based on each CREATE TABLE statement. For which I could achieve with the below command.
But the current file names that are generated is as below : F1.sql F2.sql ...
awk '/CREATE TABLE/{x="F"++i".sql";}{print > x;}' test.sql
So instead of giving F1.sql or F2.sql, I want to substitute the varaible "F" with some shell holding variable.
Current OutPut is: F1.sql F2.sql
Expected Output: Declred variable F="test"
Output: test1.sql test2.sql
Please suggest.