I tried something like this
awk -F " " '{if($1=="INSERT"){print $5}}' input.sql | \
sed -e "s/^(//g" -e "s/),(/\n/g" -e "s/['\"]//g" \
-e "s/);$//g" -e "s/,/;/g" > output.txt
But I find it slow and unoptimized
The MySQL dump file is as follows
CREATE TABLE MyTable{
data_1,
data_2
};
INSERT INTO MyTAble VALUES ('data_1','data_2'),...,('data_1','data_2');
INSERT INTO MyTAble VALUES ('data_1','data_2'),...,('data_1','data_2');
...
INSERT INTO MyTAble VALUES ('data_1','data_2'),...,('data_1','data_2');
My goal is to get a file with the following result (and without "or" for the application fields):
data_1,data_2
data_1,data_2
...
data_1,data_2
Thanks in advance!
source
share