Jump to content
Sign in to follow this  

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

Recommended Posts


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.



- Used _FileWriteToLine, _FileCountLines and StringRegExpReplace to achieve goal




Edited by ivananonymous

Share this post

Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By ivananonymous
      I am trying to determine the size of attachments from .eml files. The scenario is that I have thousands of emails in .eml file type and need to determine the size of the attachment in some of the emails. I have already determined the number of emails in which there are attachments and the number of attachments per email. Also, emails without attachments.
      Can anyone shed some light on how i can go about this? BTW, the attachments are now hashed/coded? I don't know how you call it but its just a bunch of characters.
      File attached is a sample email.
  • Create New...