Group Abstract Group Abstract

Message Boards Message Boards

0
|
5.3K Views
|
3 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Use FirstPositioning[] multiple times to separate and organise an txt file?

Posted 7 years ago

Hi everyone,

I am trying to separate and organise an txt file that I imported in Mathematica. I'd like to you the the function FirstPosition[list, keyword], this works until I want to use this function for the second/third/fourth etc time. Then mathematica just search for the first keyword and ignore the the following ones.

I tried to use: FirstPositioning[list, key word1];FirstPositioning[list, key word2];FirstPositioning[list, key word3] etc... If I try this code without the used of the semicolon than mathematica gives me the correct position of keyword 1 but not for keyword 2/3/4.

Short, what I want Mathematica to do is First search for keyword1, if found THAN look for keyword2 (from the position of keyword1) and so on.

Is there anyone who can help me with this problem, Thanks!

POSTED BY: Kim Hempel
3 Replies
POSTED BY: Neil Singer
Posted 7 years ago

Hello Neil,

Thank you, this helped me a lot! My code is almost complete except for one little thing.

My txt file exist of words and numbers and is divided in 3 columns. What I would to achieve is to make a list of (in your example) n1 to n2. This means in your example a list of: trial_list={"bbb","ccc","ddd"}.

Also, I would like to show this list for different column (first, second and third). I tried this: list = import[n1[1] ;; n2[1], 2] This gives an outcome of the whole txt file.

Is there an easy way to put one column from a specific point to another specific point?

Regards, Kim

POSTED BY: Kim Hempel
POSTED BY: Neil Singer
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard