Get .txt specific lines of text

image

Above is my text file content, I want to retrieve the file and get data inside with specific condition(get last two lines with the desired date). I successfully get the files using “Read Binary Files”, but don’t know what’s next.

Hi @hhlau, you probably want to use the Convert to/from binary data node as the next step (in older versions of n8n this node was called “Move Binary Data” instead). This lets you read the content from a binary file and make it available to n8n as a regular string:

Depending on what exactly you want to do you could also consider using the Spreadsheet file node:

This will make filtering by date as you have described much easier. Here’s a quick example workflow:

This example would leave you with the lines with timestamps from the last 10 days:

Hope this helps :slight_smile:

I actually want to get the data from the text file based on the condition and put it in at the “send email” node, Thanks!

Hey @hhlau,

based on the answer of @MutedJam you are able to achieve what you want to do. You need to change the condition in the if node to your need und then add a send mail node with you content you need.

Don’t forget:
you could ask for help in this forum. But if you want someone to work for you, then you should place a topic in the (paid) jobs section.

Cheers.

2 Likes

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