Forum Discussion
Using PowerShell to convert static URLs in docs in SharePoint
You don't mention the version of SharePoint but since you're talking about different webapps I can safely assume this is on-premises. It does appear to be possible to open a document and search text inside it, though I freely admit I have not tried a method myself to verify you can wrap SharePoint around this but it should be possible. Since there's many examples of how to loop through all documents in a site collection I won't bother with that here, but I would try reviewing https://devblogs.microsoft.com/scripting/weekend-scripter-manipulating-word-and-excel-with-powershell/ on a single document in a library to see if it works. If so, wrap that code in foreach loops (filtering out lists using like (if $list.basetemplate -eq "DocumentLibrary") and other necessary steps.
Depending on your issue, this issue shouldn't be that bad if you have SharePoint 2016 or higher with Office Online Server, and use the durable link instead of the actual physical link.