# Get data text last line

**URL:** <https://discourse.nodered.org/t/get-data-text-last-line/68796>\
**Category:** Dashboard\
**Created:** [10 October 2022 10:30 UTC](https://discourse.nodered.org/t/get-data-text-last-line/68796 "2022-10-10T10:30:59Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![chawana](https://avatars.discourse-cdn.com/v4/letter/c/ecccb3/32.png) [@chawana](https://discourse.nodered.org/u/chawana)\
**Post date:** [10 October 2022 10:30 UTC](https://discourse.nodered.org/t/get-data-text-last-line/68796/1 "2022-10-10T10:30:59Z")

</div>

Hi every one,  
some one can help to can we get data text last line?  
type or paste code here

```auto

```

---

<div class="post-metadata">

**Author:** ![chawana](https://avatars.discourse-cdn.com/v4/letter/c/ecccb3/32.png) [@chawana](https://discourse.nodered.org/u/chawana)\
**Post date:** [10 October 2022 10:31 UTC](https://discourse.nodered.org/t/get-data-text-last-line/68796/2 "2022-10-10T10:31:25Z")

</div>

```auto
[{"id":"62cbc6a05fce0d52","type":"file in","z":"847e8dec2e664a26","name":"","filename":"payload","filenameType":"msg","format":"lines","chunk":false,"sendError":false,"encoding":"none","allProps":false,"x":280,"y":280,"wires":[["40fd65138cd46e18"]]}]

```

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [10 October 2022 12:17 UTC](https://discourse.nodered.org/t/get-data-text-last-line/68796/3 "2022-10-10T12:17:19Z")

</div>

You have posted 1 single file node - not much use to anyone.

Please provide all the info a person would need to be able to help you.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [10 October 2022 12:48 UTC](https://discourse.nodered.org/t/get-data-text-last-line/68796/4 "2022-10-10T12:48:38Z")

</div>

Do you mean you want to fetch just the last line of a file?

If so then search the forum for  
last line of file

---

<div class="post-metadata">

**Author:** ![chawana](https://avatars.discourse-cdn.com/v4/letter/c/ecccb3/32.png) [@chawana](https://discourse.nodered.org/u/chawana)\
**Post date:** [11 October 2022 01:50 UTC](https://discourse.nodered.org/t/get-data-text-last-line/68796/5 "2022-10-11T01:50:34Z")

</div>

Thanks Steve , when have file(text) incomming in single file need to read last line and get this line text  
[{"id":"847e8dec2e664a26","type":"tab","label":"Flow 3","disabled":false,"info":"","env":},{"id":"e2661aa99a5ac377","type":"debug","z":"847e8dec2e664a26","name":"got ... blocks + bytes","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":600,"y":200,"wires":},{"id":"62cbc6a05fce0d52","type":"file in","z":"847e8dec2e664a26","name":"","filename":"payload","filenameType":"msg","format":"lines","chunk":false,"sendError":false,"encoding":"none","allProps":false,"x":280,"y":280,"wires":[["40fd65138cd46e18"]]},{"id":"dfad79e0345e0987","type":"inject","z":"847e8dec2e664a26","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"2022-10-7 8:15:44 07.10.22 08:15:40 Actuator failed to move on Start command 2022-10-7 8:15:46 07.10.22 08:15:40 Actuator failed to move on Start command 2022-10-7 8:15:48 07.10.22 08:17:47 Actuator failed to move on Start command 2022-10-7 8:17:49 07.10.22 08:17:47 Actuator failed to move on Start command 2022-10-7 8:17:50 07.10.22 08:17:47 Actuator failed to move on Start command","payloadType":"str","x":130,"y":220,"wires":[["62cbc6a05fce0d52"]]},{"id":"40fd65138cd46e18","type":"string","z":"847e8dec2e664a26","name":"","methods":[{"name":"getRightMost","params":[{"type":"str","value":"20"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":450,"y":280,"wires":[["e2661aa99a5ac377"]]}]

```auto

```

---

<div class="post-metadata">

**Author:** ![chawana](https://avatars.discourse-cdn.com/v4/letter/c/ecccb3/32.png) [@chawana](https://discourse.nodered.org/u/chawana)\
**Post date:** [11 October 2022 01:50 UTC](https://discourse.nodered.org/t/get-data-text-last-line/68796/6 "2022-10-11T01:50:51Z")

</div>

```auto
[{"id":"847e8dec2e664a26","type":"tab","label":"Flow 3","disabled":false,"info":"","env":[]},{"id":"e2661aa99a5ac377","type":"debug","z":"847e8dec2e664a26","name":"got ... blocks + bytes","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":600,"y":200,"wires":[]},{"id":"62cbc6a05fce0d52","type":"file in","z":"847e8dec2e664a26","name":"","filename":"payload","filenameType":"msg","format":"lines","chunk":false,"sendError":false,"encoding":"none","allProps":false,"x":280,"y":280,"wires":[["40fd65138cd46e18"]]},{"id":"dfad79e0345e0987","type":"inject","z":"847e8dec2e664a26","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"2022-10-7 8:15:44 07.10.22 08:15:40 Actuator failed to move on Start command 2022-10-7 8:15:46 07.10.22 08:15:40 Actuator failed to move on Start command 2022-10-7 8:15:48 07.10.22 08:17:47 Actuator failed to move on Start command 2022-10-7 8:17:49 07.10.22 08:17:47 Actuator failed to move on Start command 2022-10-7 8:17:50 07.10.22 08:17:47 Actuator failed to move on Start command","payloadType":"str","x":130,"y":220,"wires":[["62cbc6a05fce0d52"]]},{"id":"40fd65138cd46e18","type":"string","z":"847e8dec2e664a26","name":"","methods":[{"name":"getRightMost","params":[{"type":"str","value":"20"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":450,"y":280,"wires":[["e2661aa99a5ac377"]]}]

```

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [11 October 2022 08:37 UTC](https://discourse.nodered.org/t/get-data-text-last-line/68796/7 "2022-10-11T08:37:08Z")

</div>

Did the forum search not suggest how to do it?

---

<div class="post-metadata">

**Author:** ![chawana](https://avatars.discourse-cdn.com/v4/letter/c/ecccb3/32.png) [@chawana](https://discourse.nodered.org/u/chawana)\
**Post date:** [11 October 2022 10:06 UTC](https://discourse.nodered.org/t/get-data-text-last-line/68796/8 "2022-10-11T10:06:10Z")

</div>

Yes, not seeing this topic

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [11 October 2022 10:31 UTC](https://discourse.nodered.org/t/get-data-text-last-line/68796/9 "2022-10-11T10:31:48Z")

</div>

For me, the first hit of [Search results for 'last line of file' - Node-RED Forum](https://discourse.nodered.org/search?q=last%20line%20of%20file) is [CSV file - last line require](https://discourse.nodered.org/t/csv-file-last-line-require/11153) which appears to be be exactly what you are asking. Probably other hits there also address the issue.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [11 October 2022 11:35 UTC](https://discourse.nodered.org/t/get-data-text-last-line/68796/10 "2022-10-11T11:35:50Z")

</div>

Just to point out that I too found the post that Colin linked to.

I tried the suggestion which seemed most interesting  
`Or you can set the csv node to "a message per row" and feed it into a trigger node configured like "send nothing"; "extend delay"; "then send the latest msg object"`

It turns out that it won't work using the Read File node set to "a message per line" if the last character in the file is `\n` - almost universally the case, at least in Linux.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [10 November 2022 11:36 UTC](https://discourse.nodered.org/t/get-data-text-last-line/68796/11 "2022-11-10T11:36:46Z")

</div>

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