19,1 iMac, OSX 11.4: I can do this in Music w Apple scripts, but text documents in OS X either I have forgotten or need to learn how.
sed 's/...//' file.txt
In order for the document to include sentences on one line I have to insert breaks at end of all sentences, correct? I wish a command could recognize a sentence.Each dot is a single character. You can use egto remove first five characters, or you can use s/.....// for five. But that's by line, not by sentence, unless each sentence is on its own line.Code:sed 's/.\{5\}//' file.txt
That is a difficult condition to ensure. The simple idea would be to delete whatever number of characters following a period and space. However, you could have false positives (e.g., “The book by Dr. Seuss was…”).I wish a command could recognize a sentence.
If you have some knowledge beforehand it’s quite easy to exclude “Dr. “ from the processing - as well as define the end of a sentence incl. “!?”. @blackxacto: is this something you need often?That is a difficult condition to ensure. The simple idea would be to delete whatever number of characters following a period and space. However, you could have false positives (e.g., “The book by Dr. Seuss was…”).
Ha! Oops! I did forget about questions and exclamations. I was focused too much on the word “sentence“ and my period example.If you have some knowledge beforehand it’s quite easy to exclude “Dr. “ from the processing - as well as define the end of a sentence incl. “!?”.
No, don't need often, just for this one project. It seems so easy in Music w a script.If you have some knowledge beforehand it’s quite easy to exclude “Dr. “ from the processing - as well as define the end of a sentence incl. “!?”. @blackxacto: is this something you need often?