Jump to content

How to detect string occurrence in .txt/.eml files and manipulate/delete lines after specific occurrence?


Recommended Posts

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

Edited by ivananonymous
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...