MacFH - C E Macfarlane
c.e.macfarlane at macfh.co.uk
Wed Apr 3 05:58:23 PDT 2019
Please see below ...
On 03/04/2019 12:56, S Byers wrote:
> Small additional issue is merging the two History files!
As previously noted, though with a slight error, if the two PCs have
different *download directories*, then the paths in the history files
will be different. If reconciliation between the two is going to be a
regular job, then I've written a Perl script that does it, however, it
takes some setting up to get it running in the first place, and so
certainly would be overkill for a one-off job. I never got very far
with the documentation of it, but the script itself is quite well
documented in the form of comments. FTR, it's here:
However, you will most likely want to do this once, and therefore by
hand. You will need a decent text editor, perhaps Notepad will do, but
it will require a great deal more boring manual work than using
something like Textpad, which I have used for many years and have no
hesitation in recommending. You can download a free trial version,
which AFAICR will allow saving, and if you like it you can pay a
relatively small sum and get to keep what is just about the best
programmer's text editor there is. My sole gripe about it is that the
author will not produce a Linux version. Note also that it will
automatically back-up every so many minutes, thus overwriting the file
you are working on with your recent changes - mostly this is
desirable, but sometimes it's a nuisance.
A procedure for reconciling the history would be as follows.
1 Back up the history files on both PCs;
2 Also make a working copy of each to a different name, giving
the copies on each PC *different* names from each other;
3 Copy the working copy from one of the PCs to the other;
4 On the PC that now has both, load each into different tabs of
a good text editor;
5 For each file in its tab, do a global change and replace to
remove the paths of the downloads in field 7 and replace it with a dummy
that will be found uniquely in a subsequent global change & replace -
'<<<DUMMY>>>', without the single quotes, would do very nicely.
6 Select all of one file in its tab and copy and paste it at the
end of the other, thus appending it. You can now close the source tab
and work only with the merged tab.
7 You now have to sort the file in the merged tab and delete all
the duplicated lines. This is where Textpad scores over other editors
such as Notepad, in it choose ...
Tools, Sort, and select Delete duplicate lines
... whereas for Notepad, I'm afraid it's got to be done by
hand, though you can at least sort it by copying and pasting it into a
single column of a spreadsheet, sorting it there, and then copying and
pasting it back into the text editor again.
8 Once, however it has been done, the duplicates have been
removed from the merged tab, save this file twice, once to each of the
working copy names.
9 Reload each working copy, for the moment they are identical,
in a separate tab.
10 In each tab do a global change and replace to change
'<<<DUMMY>>>', or whatever dummy was chosen, back to the correct
download path for each PC.
11 Check each file carefully to ensure it looks correct.
12 Save the results.
12 Copy the one working copy back to its own PC, and on each PC,
remembering that you should have begun by making a backup of each
download history, copy the working copy over the actual download history.
More information about the get_iplayer