You can use AppleScript to seperate out the "<i>" and "</i>" tags found in SRT files, but would involve using AppleScript repeat loops on every paragraph or word in the TextEdit documents text, which would be very slow.
So the above shell techniques would be a better option.
But if your determined to use AppleScript, then the better option would be to use the Cocoa Framework and Classes for such a task.
So use this example text below to practice with, in a new TextEdit document, before letting this example code loose on your desired files, to make sure it's acting as desired.
original text
Code:
<i>Hello</i> <i>World</i> <i>!</i>
<i>Hello</i> <i>Again</i> <i>World</i> <i>!</i>
<i>Hello</i> <i>Yet</i> <i>Again</i> <i>World</i> <i>!</i>
AppleScript code
Code:
use AppleScript version "2.5"
use scripting additions
use framework "Foundation"
tell application "TextEdit"
set documentText to (text of front document) as Unicode text
end tell
set documentString to current application's NSString's stringWithString:(documentText)
set documentString to documentString's stringByReplacingOccurrencesOfString:("<i>") withString:("")
set documentText to (documentString's stringByReplacingOccurrencesOfString:("</i>") withString:("")) as Unicode text
tell application "TextEdit"
set text of front document to documentText
end tell
You have'nt stated which version of Mac OS your using, so the above example assumes your using OSX 10.10 or later.
And you should end up with this text below in your TextEdit document.
Code:
Hello World !
Hello Again World !
Hello Yet Again World !
I have NOT included any error checking in the above AppleScript code, which I would encourage you to do in any coding.
And you should of course check that the TextEdit application is running before trying to instruct it with AppleScript tell blocks, otherwise you will get AppleScript runtime errors.
So please only see this code as a quick and dirty proof of concept, and does NOT represent a finished or complete AppleScript application.
Hope this helps
Regards Mark