How to read text files with each file in one row?

I have several text files in one folder. There is no column separator. Contents of each file should occupy one column and one row (ie one cell). As I have 1000 text files, these will occupy 1000 rows under one column. I am reading files as per procedure given at this link. In the ‘File reader’ node, I am setting Column delimiter as none. But for each file it is creating multiple rows. How to avoid it?

image

Kindly let me know as to how to proceed?

There is no simple solution in File Reader. Node reads file line by line (string with new line at the end). You can add GroupBy Node after FileReader and add your column in Manual aggregation page with Concatenate option (value delimiter set to space). That should do the trick.
Piotr Domagała

2 Likes

Thanks. I am now circumventing it by using R code in Rsource node.

Maybe you could share your solution so if someone stumbles onto this entry there might be a solution there :slight_smile:

2 Likes

Thanks. Good idea. I have put the component on knime hub here.

2 Likes

Use the Load Text-based files node from the Vernalis community contribution.

https://kni.me/n/bCBLhAg4JEEwekTR

Steve

6 Likes

Great. it works in the manner that was required.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.