$ cat file1
UPDATE `table_name` SET `column1`='1', `column2`='2' where `id`='1';
UPDATE `table_name` SET `column1`='1', `column2`='3' where `id`='2';
UPDATE `table_name` SET `column1`='2', `column2`='2' where `id`='3';
UPDATE `table_name` SET `column1`='1', `column2`='2' where `id`='4';
UPDATE `table_name` SET `column1`='4', `column2`='1' where `id`='5';
$ cat file2
UPDATE `table_name` SET `column1`='1', `column2`='2' where `id`='1';
UPDATE `table_name` SET `column1`='5', `column2`='3' where `id`='2';
UPDATE `table_name` SET `column1`='2', `column2`='2' where `id`='3';
UPDATE `table_name` SET `column1`='1', `column2`='1' where `id`='4';
UPDATE `table_name` SET `column1`='4', `column2`='1' where `id`='5';
$ fgrep -x -v file1 -f file2
UPDATE `table_name` SET `column1`='1', `column2`='3' where `id`='2';
UPDATE `table_name` SET `column1`='1', `column2`='2' where `id`='4';
The fgrep program check each line from file 1, and if it is not contained in file 2 the line will be printed in the console.
Comments - Syncing only unique content with MySQL
Add Comment
Fill out the form below to add your own comments.Tagged as: mysql,sync,unique