IPv6 Launchipv6 ready

Syncing only unique content with MySQL 

An fast and easy way to get just the unique lines in one file, which are not in another one.

$ 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.









Insert Special:






Moderation is turned on for this blog. Your comment will require the administrators approval before it will be visible.


Tagged as:

Next>