D&C Lug - Home Page
Devon & Cornwall Linux Users' Group

[ Date Index ][ Thread Index ]
[ <= Previous by date / thread ] [ Next by date / thread => ]

[LUG] howto sync two files



I want to sync two files. I.e. if they are different, they are merged
together. 

I thought rsync was the tool for the job, but after playing with it
tonight, it just seems to do the same as cp! Or have I got it all wrong?
Help!

hendry@xxxxxxx:/tmp$ touch test1
hendry@xxxxxxx:/tmp$ touch test2
hendry@xxxxxxx:/tmp$ echo "Hello" >> test1
hendry@xxxxxxx:/tmp$ cat test1
Hello
hendry@xxxxxxx:/tmp$ rsync test2 test1
hendry@xxxxxxx:/tmp$ cat test1
hendry@xxxxxxx:/tmp$ echo "Hello" >> test1
hendry@xxxxxxx:/tmp$ cat test1
Hello
hendry@xxxxxxx:/tmp$ cat test2
hendry@xxxxxxx:/tmp$ rsync test1 test2
hendry@xxxxxxx:/tmp$ cat test2
Hello
hendry@xxxxxxx:/tmp$ cat test1
Hello
hendry@xxxxxxx:/tmp$ echo " World" >> test2
hendry@xxxxxxx:/tmp$ cat test2
Hello
 World
hendry@xxxxxxx:/tmp$ cat test1
Hello
hendry@xxxxxxx:/tmp$ rsync test1 test2
hendry@xxxxxxx:/tmp$ cat test1
Hello
hendry@xxxxxxx:/tmp$ cat test2
Hello
hendry@xxxxxxx:/tmp$

--
The Mailing List for the Devon & Cornwall LUG
Mail majordomo@xxxxxxxxxxxx with "unsubscribe list" in the
message body to unsubscribe.


Lynx friendly