How do I batch replace a long string of text with another one?
It’s at the very beginning of the text file.
I need to replace this text with…nothing…I simply have to delete it from these hundreds of files.
Well…I also have some text to remove from the very bottom of the file…
The text I want to remove is the exact same on all the files: they are HTML webpages converted to TXT, so I need to cut all the text that is not the body, such as menu and other.
Alas I can’t reach the original HTML files.
I cannot think of a “no code” solution. Probably relatively simple to do with Python but one must know the exact patterns you are searching for and what the replacement text is. And of course have to know some Python. Also, most any coding language could do this.
As others have suggested use sed or awk in a Terminal session. I have to change text like that when dealing with electoral data from my local council. Although I found the GNU version sed better than the default BSD version that comes pre-installed with macOS. (GNU sed has a few more options available when processing repetative patterns.)