Jump to content
Sign in to follow this  

Extract Text From File

Recommended Posts


I need to extract some text from a file and I'm not sure how to do it. Here is an example of what I need to do.

From: EarthLink High Speed Internet Team <dslsales@earthlink.net>

Subject: EarthLink High Speed Internet -- 6 Months for $29.95 per Month!**

Date: Fri, 19 Mar 2004 05:48:57 PDT

X-Accept-Language: en

MIME-Version: 1.0

Content-Type: multipart/alternative;


I have to extract the entire Subject line (minus "Subject: ") and leave just what the subject is and put it in a text file. In fact, I have to go through about 100 text files (named MSG1.TXT through MSG100.txt) and do the same exact thing, putting all of the subjects in a single text file.

Does anybody know how this can be accomplished?

Share this post

Link to post
Share on other sites

Something like this perhapse, if your file stays standard

while 1
if StringInstr($everything,"Subject: ")=0 then ExitLoop
    $len=StringInstr($everything,"Subject: ")+9
$line=StringMid($everything,$len,StringInStr($everything,"Date: ")-$len-1)
$everything=StringTrimLeft($everything,StringInstr($everything,"Date: "))

AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post

Link to post
Share on other sites

Genius! Thank you, scriptkitty!

Yes, with only slight modifications to account for the file names, that will work perfectly! :whistle:

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.