I have the following input in a sacro.sql
file:
{ TABLE "informix".sacro_log row size = 64 number of columns = 3 index size = 0 }
{ unload file name = sacro00518.unl number of rows = 0 }
create table "informix".sacro_log
(
log_id serial not null constraint "informix".nnc_sac_log00,
log_type integer,
log_data text
);
revoke all on "informix".sacro_log from "public" as "informix";
I want to replace 2nd line above "create table "informix".sacro_log" with test
Example output I want:
{ TABLE "informix".sacro_log row size = 64 number of columns = 3 index size = 0 }
test
create table "informix".sacro_log
(
log_id serial not null constraint "informix".nnc_sac_log00,
log_type integer,
log_data text
);
revoke all on "informix".sacro_log from "public" as "informix";
sed -z 's/[^\n]*\([[:space:]]*create\)/test\1/' sacro.sql
– Costas Apr 30 '17 at 06:12