Hi! I just want to ask what functions should I be using to do this? I want to detect the 2nd occurrence of a string in a .txt/.eml file then remove it and every line that follows. I am doing this so that I can remove all attachments from .eml files. So far, I've tried using StringRegExp to know how many occurrences of a specific string are present. I've attached a sample.eml file and the results I want to have. I just can't manually do it for I have millions of emails. The specific string is "------=_". Any suggestions will be much appreciated. *Update - Used _FileWriteToLine, _FileCountLines and StringRegExpReplace to achieve goal result.eml sample.eml