Search multiple selected RTF documents and clear (not remove) links?

I should like, if it’s possible, to able to clear automatically from a list of selected RTF documents any links within each of those documents. I cannot see that is possible with any search and replace operation or with a smart rule (but should be delighted to be contradicted).

The reason for the need is as follows. I have 18,000+ diary entries in Day One. Many (but by no means all) of those contain Day One links to other entries. I am in the process of exporting diary entries, in batches, as JSON files, importing those into Bear and then exporting each entry as an RTF file (which is the best way of preserving all the Day One data). I then use a DT batch command to rename each file with the relevant date.

I want those files/entries in DT because the search facilities in DT are infinitely superior to those in Day One. I shall, of course, retain the original Day One entries.However, I don’t really need the hassle of converting all the Day One links (which do survive the Day One > Bear > DT journey) to DT links. Ideally I’d like to clear those links but leave the text of them (for their continued presence otherwise offends my organised mind :smile: ).

I suspect a script will be mentioned but that may be an adventure too far for this “script-incompetent”. Does anyone have any (printable) ideas, please?


So, if I understand you correctly, in Markdown parlance you’d like to convert
[link text](url) to just link text.

I’d concur. Since you want to automate editing files, I do not see many alternatives to scripting. You could of course pay someone to do the work in your stead. Scripting that for RTF … well, might be possible. I for one would certainly not go there. Modifying a near-binary format without a proper API is far too risqué in my mind.
However, if you export the data from DayOne in JSON format, you could modify that. I.e. “unlink” the content of the JSON files before you import them into Bear. Depending on the format of the JSON file, that’s a task ranging from “simple” to “quite” difficult. But it should certainly be feasible.
However, do to something programmatically, you need a program. Aka “script”. Be that node.js (JavaScript) or Perl or Python or something else…

Thanks for the kind response, all of which is understood and appreciated. I may resign myself to retaining the Day One links in DT and living with my offended sense of organisation. It’s by no means the end of the world compared to venturing into the territory you mention.

Edit: Yes, you understood correctly as mentioned in your first sentence.


This is merely an update for anyone who may come across this thread at some time in the future.

I have discovered, in fact, that it is preferable to export from Bear (and thus import into DT) in markdown rather than in rtf format. The principal advantages are:

  1. You can set DT preferences to view markdown files in preview mode—which avoids the risk of an inadvertant change to any of the diary entries. (It’s very easy to use the toolbar temporarily to switch to edit mode if anything does need editing).
  2. The Day One links still work in the markdown files (unlike in the rtf files). Obviously they open linked entries in Day One rather than in DT but that, for me, is not currently a significant problem.

There’s a little tweaking to do if any entry incorporates either a photo or a table—but the tweaks are not excessively challenging…even for me!

Once all this is done you can enjoy the sheer flexibility of DT’s search facility as opposed to the very simple search faciility in Day One—which is the whole purpose of the exercise.



I know what might be problematic about photos. But what’s the deal with tables? They usually are just part of the MD files, afaik.

They were annihilated in the process of the trip from the Day One json to the Bear markdown files. I seem to recall that Day One does not strictly support tables so maybe that’s why the tables I did manage once to incorporate didn’t survive the Day One > Bear > DT trip. Anyway, there were only 3 (from 18,000!) entries with them so it was easy to reconstruct them.

Day One export options are a little odd. You have to use json if you want a separate file for each entry. Other options (pdf, HTML, markdown) produce one file containing all selected Day One entries.



1 Like