Hello-
I have a txt file with 5000 lines in it - I want knime to read the document, and return everything its read, up to a specific word. I am unsure how to do this in KNIME - any help would be greatly appreciated!
Are you reading the entire file and searching for the word or reading each row separately and searching for the same word in each row?
I am reading each row - looking for a given word. Once found, I want all rows before that, returned in my output.
Hi @love_hate_knime , if it’s only 5000 lines, I’d think that reading the whole file in and then using something like Rule Engine to write a marker on any row that contains the word, followed by a Table Splitter to return all rows up to that marker would do the job:
e.g.
$MemoText$ MATCHES ".*\bMyWordHere\b.*" => "X"
The \b
in regex signifies a “Word Boundary”
Then the top port of the Table Splitter will have your required rows.
AWESOME! Thank you so MUCH! This worked wonderfully!
Hi @love_hate_knime , you’re welcome. Glad it worked for you.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.