I have the below variables:
grep_line_new_file='create table "informix".issue'
new_file_below=`awk 'BEGIN { FS="\n[()]"; RS=";" } /$grep_line_new_file/ { print ")"$NF";"}' test`
Inside test file I have the below:
create table "informix".issue
(
issue_no serial not null constraint "informix".nnc_issue00,
user_logged varchar(8,1) not null constraint "informix".nnc_issue01,
issue_status_code integer not null constraint "informix".nnc_issue02,
issue_cat_code varchar(2) not null constraint "informix".nnc_issue03,
issue_descr text not null constraint "informix".nnc_issue04,
issue_feedback text,
user_action varchar(8,1),
date_logged date not null constraint "informix".nnc_issue05,
date_compl date
) in datadbs extent size 16 next size 16 lock mode row;
revoke all on "informix".issue from "public" as "informix";
I am having an issue using an external variable to find and get the line below I need when echoing the "$new_file_below".
I have tried using the below [awk -v]. It still does not want to work:
new_file_below=`awk -v val="$grep_line_new_file" 'BEGIN { FS="\n[()]"; RS=";" } /$val/ { print ")"$NF";"}' test`
The outcome I need from the "new_file_below" variable is below:
) in datadbs extent size 16 next size 16 lock mode row;