Mobileread
Help! Is it possible to merge 2 sets of .ini files?
#1  Mister L 10-16-2019, 08:25 PM
I have no idea how this happened (Sigil crashed a couple of times recently and I presume it happened then, although I am pretty sure I still had everything intact after the last crash and right up to a few hours ago...) but I just noticed that somehow QUITE A LOT of my clips and saved searches have disappeared. Most of them, in fact.

I do have backups of the .ini files but the last one is from the 26th of September and like an eedjit despite making a mental note to do it "as soon as I finish this" I did not make new ones after recently adding / modifying some of these. x( (Lesson learned. Modify clips and / or saved searches, make new backup IMMEDIATELY afterwards).

Using the Compare feature of Notepad++ I can see that there are things present in the saved backup that are gone BUT also some of the recent changes have been preserved in the current files... so I don't think I want to just replace the current file with the backup.

But I also noticed there are numbers at the beginnings of the lines which presumably tell Sigil the order to present the items and if I copy-paste the missing stuff from one file to the other it wreaks havoc with those and I am really not sure I feel up to re-doing all the numbers by hand (saved searches has more than 700 lines of code, plus in addition to adding some new things recently I also modified the order of certain groups). :/

So my question is this:
Is there any way to merge two sets of .ini files to keep the most recent info from each one and get as complete a set of data as possible? (maybe using something a little more sophisticated than just a text editor?)

I realise this is unlikely but before I give up I'd rather ask because you never know...

(Even better --but obviously I don't believe this will be possible even for a second...-- is there any way to recover the .ini versions from, say, this morning / yesterday?)

I'll leave things alone until tomorrow (it's bedtime for me now) and hope that miraculously by then someone will have a solution (bearing in mind that I am not a dev and while I am not afraid of code my skills are limited and basic and my tools stop at Notepad++ and whatever comes by default with Windows 8.1). :/

Thanks in advance for any advice (other than "more frequent backups stupid." Please don't kick me while I'm down).
Reply 

#2  KevinH 10-16-2019, 09:47 PM
Yes it is possible. It could be done with a text editor that supports just ascii and NOT utf-8 and very very careful cutting snd pasting be sure to get all of the data associated with each key.
Reply 

#3  Mister L 10-17-2019, 08:42 AM
Quote KevinH
Yes it is possible. It could be done with a text editor that supports just ascii and NOT utf-8 and very very careful cutting snd pasting be sure to get all of the data associated with each key.
Oh good news! Can you recommend a text editor (I am pretty sure Notepad supports utf-8 and also the windows blocknotes does because it sometimes warns me not to save as ascii if I don't want to lose formatting)?

What about the numbers at the beginning of the lines though, if I leave them alone will they cause trouble / would I have to re-do them manually?
Reply 

#4  Mister L 10-17-2019, 08:44 AM
I'm so furious at myself for this, usually I am very "MY PRECIOUSSSSS" about my ini files and the instant I make a change I make a new backup, I have all the backups in a folder locally and the most recent one is also stored in dropbox JUST TO BE SURE... of course it had to be the ONE TIME I don't make a new backup that I lose them.
Reply 

#5  Mister L 10-17-2019, 09:21 AM
Quote Mister L
Oh good news! Can you recommend a text editor (I am pretty sure Notepad supports utf-8 and also the windows blocknotes does because it sometimes warns me not to save as ascii if I don't want to lose formatting)?

What about the numbers at the beginning of the lines though, if I leave them alone will they cause trouble / would I have to re-do them manually?
Okay I've installed text-morph because it was the first text editor for ascii I found (I couldn't find a way to select ascii format anywhere in NotePad or windows block-notes).

So now I'm really just worried about the line numbers: are they going to be problematic? Can Sigil sort out duplicates and correct them or is that asking too much? (If I just copy-paste directly I am almost sure I will end up with duplicate numbers).
Reply 

#6  KevinH 10-17-2019, 10:14 AM
Run a test. First just copy both ini files to create backups in case a mistake is made. Then start with a fresh default or known good ini file created by Sigil. Then copy from one of the ini files just one item and paste it into the known good ini. Fire up Sigil to see if it is recognized. Close out of Sigil. Then repeat with something from the other ini file. You may have to renumber some of the numbered list. Fire up Sigil to see if it was accepted.

Rinse and repeat.
Reply 

#7  theducks 10-17-2019, 10:59 AM
Quote Mister L
Oh good news! Can you recommend a text editor (I am pretty sure Notepad supports utf-8 and also the windows blocknotes does because it sometimes warns me not to save as ascii if I don't want to lose formatting)?

What about the numbers at the beginning of the lines though, if I leave them alone will they cause trouble / would I have to re-do them manually?
Notepad++
It supports almost everything a coder could want
(while viewing) Colorizes tags, bracket pair match ...
and it is easy on the wallet: Free
Reply 

#8  Mister L 10-17-2019, 07:09 PM
Quote KevinH
Run a test. First just copy both ini files to create backups in case a mistake is made. Then start with a fresh default or known good ini file created by Sigil. Then copy from one of the ini files just one item and paste it into the known good ini. Fire up Sigil to see if it is recognized. Close out of Sigil. Then repeat with something from the other ini file. You may have to renumber some of the numbered list. Fire up Sigil to see if it was accepted.

Rinse and repeat.
Good plan, thanks. For the moment I have just gone back to the last saved version because I have files to finish for clients but hopefully soon I'll have time to try and cobble this whole thing back together. :/ The good news is, I think I didn't lose quite as much as I originally thought, so fiou.

Quote theducks
Notepad++
It supports almost everything a coder could want
(while viewing) Colorizes tags, bracket pair match ...
and it is easy on the wallet: Free
Thanks that's actually the one I already use (what would we do without the compare feature right ??) but I couldn't find a way to save as ascii, only other formats (ansi, utf-whatever...). Is there a trick I don't know?
Reply 

#9  theducks 10-17-2019, 07:28 PM
Quote Mister L
Good plan, thanks. For the moment I have just gone back to the last saved version because I have files to finish for clients but hopefully soon I'll have time to try and cobble this whole thing back together. :/ The good news is, I think I didn't lose quite as much as I originally thought, so fiou.



Thanks that's actually the one I already use (what would we do without the compare feature right ??) but I couldn't find a way to save as ascii, only other formats (ansi, utf-whatever...). Is there a trick I don't know?
AFAIK it only saves in the format you are editink. There are tools to chang the encoding ((ASCII, UTF-x), The type of EOL.
But on the whole, you just edit and it does not change the mode of the file.
Reply 

Today's Posts | Search this Thread | Login | Register