×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Breaking a data file up

Breaking a data file up

Breaking a data file up

(OP)
Hi,

I am trying to read a file and extract only a section of it, for example if the read file was the text below I would only want to extract the text between "test1" and end_test", which would be "this is a test to see if i can get these words from this file." My goal is to take only the useful portion and write it to another file for use later on in my program.  Any ideas on how to actually get only the section of the file that I want?

Thanks.

-----------------------------------------------------------
brewvouibreouvibuorebvourebvoubreouvberoubvorebvorebvorebvouibreobvreoabvoubrewbuovbroeubvoarewbv';barwe'ovb test1 this is a test to see if i can get these words from this file end_test poinfwoiprnvioprwevioerovbierovoewrnvpiwnrviopnreovinerov
-----------------------------------------------------------

RE: Breaking a data file up

ohagan,

Try textscan

You can have it read one %s, string, at a time which i think it considers a space or carriage return delimited series of alpha numeric characters.  Then an if statement for the exact string you want. Like 'test1 '.

Hope this helps

BSK

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources