Global Find and Replace

No, I support Annard’s comments. Under very special circumstances (certainly not for the databases most users create) I can conceive of the utility of scripting the ability to modify text documents.

But that should be complicated enough to keep the casual idiot from screwing up his database. And it is. An idiot who wishes to change the text of his reference collections (perhaps Shakespeare sonnets) – perhaps randomly? – will need determination and some knowledge of AppleScript. Who knows. Perhaps the results would be interesting. :slight_smile:

DT Pro provides a number of tools for power users. Fortunately, most power users seem to know what they are doing.

I’m glad to see the progress you’re making, but discussing “scripting” as an approach to global search and replace in relation to DEVONthink is pointless, since anyone who wants to do such “Applescripting” to search and replace text in a collection of documents doesn’t need DEVONthink in the least.

Why don’t you discuss it in a nice Applescript forum?

The omission of global search and replace, though, in any program such as DEVONthink that purports to provide a user with managment of large collections of text documents is a gross and glaring omission, and always will be. It was the same with FileMaker Pro. The developers, in their wisdom, and to their credit, finally provided it.

Just because you, personally, don’t need or want such capability doesn’t affect in the slightest the valid need for such capability in a vast variety of uses.

Denriddy

Comment from the peanut gallery: sometimes there is a direct ratio between the number of messages posted and the arrogance of the messenger’s tone. I admire the folks at DT for the patience and generosity they display at all times.

This is the first time I’ve seen this suggestion or request in the forum, which would leave me to believe it’s not exactly a feature in high demand.

Just because you personally need or want such capability doesn’t affect in the slightest the fact that it seems to be an obscure feature request, which can actually be implemented by the user using the tools provided in the software.

I’d also agree with Howarth on the admiration for the DevonThink posters. I’ve lurked in the forums for a long time, and these have been the most condescending replies to attempts to help that I’ve seen.

Yes, I was trying to help, and to get help in return, and yes, I did get these insufferably condescending replies:

I’m willing to continue returning it in kind as long as it keeps coming, while also attempting to discuss the actual issue rationally with anyone who can discuss the topic itself without descending into amateur forum-post criticism—which surely must be the lowest form of literary criticism one could aspire to.

Meanwhile…

Actually, there is one other request for it that I ran across in this forum, posted in conjunction with a request for a way to globally change document titles. The global string search & replace part was ignored, though some kind of workaround was suggested for the document title issue.

Furthermore, I’ve been in marketing for over 25 years, and, just personally (and professionally), I never would allow any client of mine to rely on such data as “absence of requests in web forum.”

I’d love, though, to see an actual survey of users and, especially, of potential end users asking whether such capability would be of value and use. That would supply valid, useful marketing information in relation to the value of such functionality in a document management program.

Denriddy

Dinriddy, the responses you received were intended to be helpful, and to gently point out to you that your preconception that a database should be easily changed by a “blind” operation such as search and replace would be a very bad idea.

Those responses were not “insufferably condescending”. They were honest and without attitude.

Do you understand why simple search and replace across many thousands of documents would be a dangerous design element rather than a feature?

Sir, no one has condescended to you at all. You seem to have a massive chip on your shoulder and it comes out in demanding, hostile, impatient tones. This is a public forum and you ought to make your remarks civil. You may know much about marketing, but you are addressing a large group of people with all sorts of expertise. I’m a professional literary critic with 40 years of publications, and when I say that your tone is arrogant, that judgement is not one by an amateur. By all means, continue to make your case, but don’t act as though you are in combat with a bunch of enemies or nincompoops.

Not at all. There are far more “dangerous,” potentially destructive operations built right into the program already, even more provided in the Applescript menu. I would expect you know these already, even while mounting and persisting with this meritless argument, but if you don’t, I will list them for you.

Denriddy

In that case, I am indeed honored to have been declared arrogant by a professional in the field of arrogance.

Denriddy

Oh well, now you’re just being childish. Do you approach marketing in this fashion? I conclude that you’re just trolling for trouble. I am all through with this thread.

My comments relate to Global Find, only, and I can certainly see many valid needs for the Replace function, say when a Government Department changes it’s name, yet again.

Very late to this discussion, which probably makes it pointless to post, but I am here after the stunning realisation dawned, after this morning’s and previous weeks of struggling up the leaning curve of DtPO, that my anticipation of being able to pour my groaning stacks of documents into my very expensive (for me) ScanSnap then into DtPO, and then be able to search on them for any trigger-word or conditional phrase, and do that globally (as I have done in iData since it was QuickDex, from 1985 on) is not possible.

I am shattered by this discovery. That, after nearly a year of pre-purchase research, expenditure and bafflement has passed, I have only now discovered that the very easy-to-use Paperless only saves images, and can only search on related personal meta-data that one enters for that image, and that the complex and expensive DEVONthink Pro Office, while able to OCR and save all of a document’s text with the raw image, is none-the-less unable to search it’s databases of that text, to me the main purpose of it’s existence.

Where to go from here? Probably to the nearest pub/bar to get spastic, to try to forget this waste of money & time.

The narrative is unfortunate but …

is absolutely not the case. DEVONthink will search text content within a single database, across databases, and within single documents. Search scopes can include numerous elements: the text content of PDFs, plain text and RTF documents, and many other doc types; tags and document metadata; and many other fields. (Just look at the capabilities of Tools > Search or examine the options available with Smart Groups.)

How are you searching? In the toolbar search box? In Tools > Search? (BTW, If you open a Find box using command-f, then the scope of that is limited to the currently selected document, not the database(s)).

DEVONthink’s search capabilities are very powerful. Please provide more info as to what you are doing that doesn’t work.

The original OP did not complain that DEVONthink is unable to search for a text string across all open databases, The complaint was that DEVONthink did not afford the opportunity to replace a found text string in all documents – which, in my opinion, would be a potentially destructive and undesirable operation for most users, who may have tens of thousands of documents, some of which may be legal or financial records whose alteration might have consequences.

I always use the full Search window, which not only makes it possible to search across all open databases, but provides potentially useful features not available in the Toolbar query field.

Although the tone of some of the contributors to this thread is both unfortunate and, IMHO, to be deplored there is some good come out of it, this little hint from Korm is one example. may I make a suggestion that one of the more knowledgeable members write a sticky on searching within the application, if, that is, they have the time and inclination to do so? I would but I absolutely do not have the knowledge but would very much value such a sticky.

Finally may I say that I believe that the vast majority of members are very grateful to those expert contributors who unfailingly give good, solid advice and I thank them for their patience. :smiley:

What would you like in a sticky forum topic about searching that’s not covered in search-related Tips and Tutorials?

Excellent! Thanks for reminding me.

While I understand the dangers of such a feature, I too would love to be able to do a global find a replace across a database.

I have a database with 3,000+ notes I imported from a program called Scholar’s Aid. In the process of exporting those notes into rtfs, all of the Spanish language diacritics were switched in a systematic way. é became È, í became Ì, and so on. Since I don’t otherwise use the characters È, Ì, Ò, Û, and others, it would seem useful to just do a global find a replace for each of them instead of going file by file as I currently do.

1 Like

[Cross-posting this here as well.]

From what I can tell, no changes have been made within the app to support multi-file search-and-replace, so I figured I’d share the solution I ended up using in case it helps someone else down the line.

While @korm’s script is much appreciated, the warnings gave me pause, so I sought something a little more robust and familiar. Enter VS Code.

:warning: I haven’t spent enough time with this to be 100% sure that I didn’t bork something. So far so good, though. :nerd_face:

Use Case

I have a few thousand markdown files exported from Ulysses representing about 5 years of world-building notes for a future fiction book series. About two years in, I changed the name of a major character, but didn’t bother to go back and fix it because, well, Ulysses also doesn’t have a global search-and-replace. :pensive:

I’d already imported all the files into DT by way of discovering whether it’s got what I need to help me rediscover my own thoughts (answer: probably!). I’d also completed a major tagging exercise designed to help me track the source of each note as I begin to slice and dice and rearrange them. Only mentioning this because, if I’d known that global search-and-replace wasn’t going to be available in-app, I’d probably have reversed the order, fixing updating the character’s name in the original markdown files before importing into DT.

The Solution

  1. Prep

    • File > Export > Database Archive… #safetyfirst!
    • Smart Group to collect all files containing the old character name
  2. Update document titles

    • Select all files in the Smart Group
    • Scripts menu > Rename > Replace Text…

    This allowed me to change ever occurrence of “Adrian” to “Adrim” in the file list.

  3. Update file contents

    • Right-click on the database and select Show in Finder
    • Right-click on the revealed .dtBase2 file > Open With > Other…
    • Select Visual Studio Code
    • Perform a global replacement in VS Code, being careful to use whole-word search and carefully inspecting the search results before performing the bulk replacement. Caveat lector: this is where it’s possible to do some real damage if you don’t know what you’re doing!

    Once VS Code had saved all the file changes, they appeared instantly in DEVONThink! #problemsolved

Needless to say, this should work with any other text editor, be it a command-line tool, Atom/Sublime, BBEdit…whatever. It’s rather wonderful that DT’s “database” is just a file bundle rather than in some inscrutable binary, thus enabling this kind of back-door power fix.

Thanks again, DT Team!