synchronizing part of a file
jw at pegasys.ws
Tue Oct 15 22:10:00 EST 2002
On Tue, Oct 15, 2002 at 12:20:30PM +0100, rolf.hausammann at accenture.com wrote:
> Hi all,
> I would like to synchronize a part of the source file with a part of the
> destination file. In detail I would like to
> - synchronize a file on a remote host from line "n" onwards with the
> file content on the local host starting with line "n" in the file.
> - the firs "n" lines of the files on the local and remote host should
> not be changed.
> My questions are:
> 1) Is it possible to do this with rsync?
> 2) Has anyone done that before?
> 3) How can I do this/where can I get more information?
1) not without lots of surrounding logic.
2) it hasn't been reported on the 6 o'clock news.
3) too many ways and places to list.
I'd start by reexamining the problem. Rsync is for
syncronizing directory trees and incendentally files.
Only syncronizing part of a file is a very unusual
requirement. In most cases when a very unusual requirement
appears (like this one) it is because the available options
haven't been explored.
This sounds like a config file, most config file formats
support something like an #include directive so you can
seperate local from global. The same holds true for
More than one person has suggested doing cut; rsync; cat
If it does come to that it might be better to only cut once.
Keep it as two seperate files and cat them together into a
third after each rsync. But first explore the possibility
of having whatever uses the file read from to files instead
of the one; that would be less fragile.
J.W. Schultz Pegasystems Technologies
email address: jw at pegasys.ws
Remember Cernan and Schmitt
More information about the rsync