andrew_121
Programmer
Hi ,
i want to retrive in between data from parenthesis and i a getting errors while run the awk.i have 2 files and want to process 1st file pattern to 2nd file.
pattern_file.txt
--------------
ABCD
PQRS
XYZ
INPUT FILE.TXT
----------------
CRAETE TABLE ABCD
(
A,
B,
C
);
CREATE TABLE PQRS
(
P,
R
);
SO HERE IN CASE 1ST PATTERN READS AND LOOK INTO INPUT FILE.TXT AND IF FINDS THE MATCH IT SHOULD GET THE DATA BETWEEN PARENTHESIS
A,
B,
C
NEXT PATTERN PQRS AND IT MATCHES AND GETS THE RESULT
P,
R
NEXT XYZ COMES AND NO MATCH SO NOTHING RETURNED.
MY CODE
-------
for i in `cat pattern_file.txt`
do
awk '/'{print "$i"}'/{flag=1;next}/);/{flag=0}flag' INPUT_FILE.txt
done
i want to retrive in between data from parenthesis and i a getting errors while run the awk.i have 2 files and want to process 1st file pattern to 2nd file.
pattern_file.txt
--------------
ABCD
PQRS
XYZ
INPUT FILE.TXT
----------------
CRAETE TABLE ABCD
(
A,
B,
C
);
CREATE TABLE PQRS
(
P,
R
);
SO HERE IN CASE 1ST PATTERN READS AND LOOK INTO INPUT FILE.TXT AND IF FINDS THE MATCH IT SHOULD GET THE DATA BETWEEN PARENTHESIS
A,
B,
C
NEXT PATTERN PQRS AND IT MATCHES AND GETS THE RESULT
P,
R
NEXT XYZ COMES AND NO MATCH SO NOTHING RETURNED.
MY CODE
-------
for i in `cat pattern_file.txt`
do
awk '/'{print "$i"}'/{flag=1;next}/);/{flag=0}flag' INPUT_FILE.txt
done